def round_up(i):

    if i % 10 == 0:

        return i

    return 10 - i % 10 + i





minutes = [int(eval(input())) for i in range(5)]

m = [round_up(i) for i in minutes]

last = min((minutes[l] - 1) % 10 for l in range(5)) + 1



print((sum(m) + last - 10))

import sys

stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)



i_i = lambda: int(i_s())

i_l = lambda: list(map(int, stdin.readline().split()))

i_s = lambda: stdin.readline().rstrip()



arr = [i_i() for _ in range(5)]

arr.sort(key=lambda a: a%10)



flag = True

ans = 0

for x in arr:

    if flag and x % 10 >= 1:

        ans += x

        flag = False

    else:

        if x % 10 != 0:

            ans += (x + 10) // 10 * 10

        else:

            ans += x // 10 * 10



print(ans)
def round_up(i):
    if i % 10 == 0:
        return i
    return 10 - i % 10 + i


minutes = [int(eval(input())) for i in range(5)]
m = [round_up(i) for i in minutes]
last = min((minutes[l] - 1) % 10 for l in range(5)) + 1
print((sum(m) + last - 10))

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
arr = [i_i() for _ in range(5)]
arr.sort(key=lambda a: a % 10)
flag = True
ans = 0
for x in arr:
    if flag and x % 10 >= 1:
        ans += x
        flag = False
    else:
        if x % 10 != 0:
            ans += (x + 10) // 10 * 10
        else:
            ans += x // 10 * 10
print(ans)

-def round_up(i): -    if i % 10 == 0: -        return i -    return 10 - i % 10 + i +import sys - -minutes = [int(eval(input())) for i in range(5)] -m = [round_up(i) for i in minutes] -last = min((minutes[l] - 1) % 10 for l in range(5)) + 1 -print((sum(m) + last - 10)) +stdin = sys.stdin +sys.setrecursionlimit(10**7) +i_i = lambda: int(i_s()) +i_l = lambda: list(map(int, stdin.readline().split())) +i_s = lambda: stdin.readline().rstrip() +arr = [i_i() for _ in range(5)] +arr.sort(key=lambda a: a % 10) +flag = True +ans = 0 +for x in arr: +    if flag and x % 10 >= 1: +        ans += x +        flag = False +    else: +        if x % 10 != 0: +            ans += (x + 10) // 10 * 10 +        else: +            ans += x // 10 * 10 +print(ans)