import re


def extract_year(text):
    # type: (str) -> int
    """Attempts to extract the first four digits in sequence from a string, defaults to 0"""
    data = re.search(r"\d{4}", text)
    return int(data.group()) if data else 0