CREATE TABLE table_name_40 (weeks_on_chart INTEGER, position VARCHAR(255), year VARCHAR(255))
What is the average weeks of a song with a larger than 3 position after 1977?
    
SQL: SELECT AVG(weeks_on_chart) FROM table_name_40 WHERE position > 3 AND year > 1977