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

v = [a,b,c,d,e]

import math

times = [ math.ceil(a/10)*10,
          math.ceil(b/10)*10,
          math.ceil(c/10)*10,
          math.ceil(d/10)*10,
          math.ceil(e/10)*10 ]

digit1 = [a - a//10*10,
          b - b//10*10,
          c - c//10*10,
          d - d//10*10,
          e - e//10*10]

m = 10
tt = 0
idx = 99

for i in range(5):
    tt += times[i]
    if 0 < digit1[i] and digit1[i] < m:
        m = digit1[i]
        idx = i

print('{}'.format(tt - times[idx] + v[idx]))
