def calculate_directions(directions):
    """
    Input: An iterable of (direction, unit)
    Output: A summarized collection of directions (x, y)
    """
    x = 0
    y = 0
    for direction, unit in directions:
        assert direction in ['forward', 'down', 'up']
        if direction == 'forward':
            x += unit
        elif direction == 'down':
            y += unit
        elif direction == 'up':
            y -= unit
    return x, y