import io


def parse(stdin: io.TextIOWrapper) -> list:
    """
    Parse the input into a list of tuples: string direction and int distance.
    """

    return [
        (line[0], int(line[1:]))
        for line in stdin.read().strip().splitlines()
    ]