a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = (a - 1) // 10 + 1
bb = (b - 1) // 10 + 1
cc = (c - 1) // 10 + 1
dd = (d - 1) // 10 + 1
ee = (e - 1) // 10 + 1

aaa = a % 10
bbb = b % 10
ccc = c % 10
ddd = d % 10
eee = e % 10

print(((aa + bb + cc + dd + ee) * 10) -
      (10 - sorted(set([aaa, bbb, ccc, ddd, eee, 0]))[1]))
