# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)

m = [e for e in n%10 if e not in dl]
s = np.ceil(n/10)*10
print(int(np.sum(s)-min(m))