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

list = [a,b,c,d,e]
mod = []
ten = []

for i in range(5):
    m = list[i]%10
    X = list[i]-m
    if m != 0:
        X += 10
    if m != 0:
        mod.append(m)
    ten.append(X)
    
print(sum(ten)+min(mod)-10)