import numpy as np

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
array = np.array([a, b, c, d, e])
rlist = [a % 10, b % 10, c % 10, d % 10, e % 10]
minr = min(rlist)
value = 10 - minr
tenList = [int(a / 10) * 10 + 10, int(b / 10) * 10 + 10, int(c / 10) * 10 + 10, int(d / 10) * 10 + 10, int(e / 10) * 10 + 10]
sumv = sum(tenList)
print(int(sumv - value))