import re


def parse(pattern, line):
    """
    Parses an int field and returns the value if found. Returns -1 if no value found.

    Args:
        pattern: regex pattern
        line: input line

    Return:
        field value
    """

    field = re.search(pattern, line)
    return int(field.group(1)) if field else -1