Were M4 and M5 directed by a employee of M1 , M2 , and M3 and directed by a screenwriter
SELECT count(*) WHERE {
?x0 a ns:film.writer .
?x1 ns:people.person.employment_history/ns:business.employment_tenure.company M1 .
?x1 ns:people.person.employment_history/ns:business.employment_tenure.company M2 .
?x1 ns:people.person.employment_history/ns:business.employment_tenure.company M3 .
M4 ns:film.film.directed_by ?x0 .
M4 ns:film.film.directed_by ?x1 .
M5 ns:film.film.directed_by ?x0 .
M5 ns:film.film.directed_by ?x1
}