import numpy as np
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

r = np.array([a, b, c, d, e])
k = (r > 0).sum()
l = r[r != 0].min()
print(A + B + C + D + E + 10*(k-1) + l)