text: 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_31 (rank INTEGER, matches VARCHAR, total VARCHAR, county VARCHAR)
  ### Question:
  what is the rank when the total is 39 in the county of dublin and the matches is less than 4?
  ### Answer:
  SELECT AVG(rank) FROM table_name_31 WHERE total = 39 AND county = "dublin" AND matches < 4