Below is an context that describes a sql query, paired with an question that provides further information. Write an answer that appropriately completes the request.  # noqa: E501
### 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