Write SQL query to solve given problem: How many cars on a train that runs in the east direction have a flat roof?. Keep the solution inside sql tag ```sql [SQL-Query] ```
SELECT SUM(CASE WHEN T1.roof = 'flat' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east'