with open("input.txt", 'r') as f:
    crabs = list(map(int, f.read().strip().split(',')))

    min_pos = min(crabs)
    max_pos = max(crabs)

    min_fuel = float('inf')
    for p in range(min_pos, max_pos + 1):
        cur_fuel = 0
        for c in crabs:
            cur_fuel += sum(range(1, abs(c - p) + 1))

        min_fuel = min(min_fuel, cur_fuel)

    print(crabs)
    print(f"{min_pos} {max_pos}")
    print(min_fuel)