My goal is to add an external email address as a Guest member to an Office 365 Group. I need help transforming the email address string to the form user_domain#tenant.onmicrosoft.com.
Say for example that my guest's email address is john@msn.com.
I have confirmed that the Add member to group block allows to add john_msn.com#EXT#contoso.onmicrosoft.com to an Office 365 Group in the Contoso tenant, as follows:

So far I have been able to assign john to a string variable with these blocks:

I know that I can obtain the domain string by simply extracting a substring starting from character @ for a length of total length minus "@position". This is where I'm stuck. From there I would only need to append my substrings in the right order:
user_domain#EXT#tenantconstant.onmicrosoft.com
What expressions should I use inside what blocks to accomplish this?
Thank you in advance!