# TODO B - Five Dishes
# https://atcoder.jp/contests/abc123/tasks/abc123_b

NUM_DISHES = 5
intervals = list()

total_time = 0
for i in range(NUM_DISHES):
    serve_time = int(input())
    total_time += serve_time

    if serve_time % 10 == 0:
        intervals.append(0)
    else:
        intervals.append(10 - serve_time % 10)

intervals.sort()

for interval in range(len(intervals) - 1):
    total_time += intervals[interval]

print "{:d}".format(total_time)
