CREATE TABLE table_name_40 (goals_for VARCHAR(255), played VARCHAR(255), draws VARCHAR(255), losses VARCHAR(255))
What is the total number of goals when there are 3 draws, more than 18 losses, and played is smaller than 38?
    
SQL: SELECT COUNT(goals_for) FROM table_name_40 WHERE draws = 3 AND losses > 18 AND played < 38