Was M3 distributed by M4 and M5 and produced by a production company that M1 and M2 were distributed by
SELECT count(*) WHERE {
?x0 a ns:film.production_company .
?x0 ns:film.film_distributor.films_distributed/ns:film.film_film_distributor_relationship.film M1 .
?x0 ns:film.film_distributor.films_distributed/ns:film.film_film_distributor_relationship.film M2 .
M3 ns:film.film.distributors/ns:film.film_film_distributor_relationship.distributor M4 .
M3 ns:film.film.distributors/ns:film.film_film_distributor_relationship.distributor M5 .
M3 ns:film.film.produced_by|ns:film.film.production_companies ?x0
}