import numpy as np
import sys

input = sys.stdin.readline


x = []
for _ in range(5):
    x.append(int(input()))


min_x = 9
flag = False
cnt = 0

y = []

for a in x:
    if a%10 != 0:
        y.append((a//10)*10+10)
        min_x = min(a%10,min_x)
    else:
        y.append(a)

print(sum(y)-(10-min_x))