Was M3 produced by a star of M1 and M2 and written by M0 's actor
SELECT count(*) WHERE {
?x0 ns:film.actor.film/ns:film.performance.character M0 .
?x1 ns:film.actor.film/ns:film.performance.film M1 .
?x1 ns:film.actor.film/ns:film.performance.film M2 .
M3 ns:film.film.produced_by|ns:film.film.production_companies ?x1 .
M3 ns:film.film.written_by ?x0
}