import sys
from collections import defaultdict


def main():
    target_min_x, target_max_x, target_min_y, target_max_y = [
        int(v)
        for r in sys.stdin.read().split(": ")[1].split(", ")
        for v in r.split("=")[1].split("..")
    ]

    time_to_dxs = defaultdict(list)
    time_to_dys = defaultdict(list)

    hit_max_y = 0

    for dy in range(target_min_y, 1 - target_min_y):
        max_y = y = 0

        for t in range(sys.maxsize):
            y += dy - t
            max_y = max(max_y, y)

            if y < target_min_y:
                break

            if y <= target_max_y:
                hit_max_y = max(hit_max_y, max_y)
                time_to_dys[t].append(dy)

    print(hit_max_y)

    for dx in range(target_max_x + 1):
        x = 0

        for t in range(max(time_to_dys) + 1):
            x += max(0, dx - t)

            if target_min_x <= x <= target_max_x:
                time_to_dxs[t].append(dx)

    print(
        len(
            set(
                (x, y)
                for t in time_to_dxs.keys() & time_to_dys.keys()
                for y in time_to_dys[t]
                for x in time_to_dxs[t]
            )
        )
    )


if __name__ == "__main__":
    main()
