Multisite subfolder and subdomain

I got a WP391 website : ok

It is design with on theme : ok

I have to got multisite in 2 modes :

1. subfolder : need to have 50 different multisite with 3 different themes

2. subdomain : if a client wants to create a site, I need it like :

Need to have subfolder and subdomain. How can I do ?

Thank you