from pathlib import Path


def read_polymer(path: Path) -> tuple[str, dict]:
    """Reads a submarine polymerization equipment formula file."""
    with open(path, "r") as file:
        data = file.read().split("\n")
    template = data[0]

    rules = {}
    for rule in data[2:]:
        key, value = rule.split(" -> ")
        rules[key] = value
    return template, rules