My question is about how we form the cases when numbers are made up of multiple parts.

For example:

of one hundred ста

But - if it is "of one hundred and eighty" is this: сто восмидесяти or ста восмидесяти?

Or, again - if it is "of one hundred and seventy-eight" is it сто семьдесять восьми or ста семидесяти восьми?

I.e. is it only the last part which goes into the case (in this case genitive) - or is it every single part of it?

спасибо