import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10
L = list[A,B,C,D,E]
min_ = L.index(min(L)
A = math.ceil(a)
B = math.ceil(b)
C = math.ceil(c)
D = math.ceil(d)
E = math.ceil(e)
m = A+B+C+D+E
if min_ == 0:
  m = m - A + a
elif min_ == 1:
  m = m - B + b
elif min_ == 2:
  m = m - C + c
elif min_ == 3:
  m = m - D + d
elif min_ == 4:
  m = m - E + e
print(m)

               