import numpy as np

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

M = np.array([a, b, c, d, e])
t = np.array(list(map(lambda x: x%10, M)))
tt = min(t[t != 0])

if len(M[t == tt]) != 1:
    MS = sorted(M)
    MM = [MS[0]]
    MMM = MS[1:]
else:
    MM = M[t == tt]
    MMM = M[t != tt]

s = np.array(list(map(lambda x: -(-x//10*10), MMM)))

wk = np.concatenate([MM, s])
ans = sum(wk)
print(ans)