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