CREATE TABLE table_name_87 (laps INT, constructor VARCHAR, grid VARCHAR, time_retired VARCHAR)

What is the average laps for a grid larger than 2, for a ferrari that got in an accident?
SELECT AVG(laps) FROM table_name_87 WHERE grid > 2 AND time_retired = "accident" AND constructor = "ferrari"
SELECT AVG("laps") FROM "table_name_87" WHERE "accident" = "time_retired" AND "constructor" = "ferrari" AND "grid" > 2