How to concatenate subject using ifElse for different conditions

Dear All,

Please assist me

I have three conditions where i have requirement to achieve through studio in subject of opportunity. I am getting problem with ifElse statement.

Whenever opportunity creates from leads then subject will be:
concat(related($leads_opportunities_1,"account_name"),"-",related($avdp_products_opportunities_1,"name"))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Whenever opportunity creates from accounts then subject will be:
concat(related($accounts,"name"),"-",related($avdp_products_opportunities_1,"name"))

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Whenever opportunity creates from opportunity itself then subject will be:
concat(concat(related($accounts,"name"),"-",related($leads_opportunities_1,"name")),"-",related($avdp_products_opportunities_1,"name"))

Thank You

Shiv