A = input()
B = input()
C = input()
D = input()
E = input()

A1= A//10
A2= A%10
B1= B//10
B2= B%10
C1= C//10
C2= C%10
D1= D//10
D2= D%10
E1= E//10
E2= E%10

if A2*B2*C2*D2*E2 != 0:
  S1=(A1+B1+C1+D1)*10+40+E
  S2=(B1+C1+D1+E1)*10+40+A
  S3=(C1+D1+E1+A1)*10+40+B
  S4=(D1+E1+A1+B1)*10+40+C
  S5=(E1+A1+B1+C1)*10+40+D
  print min([S1,S2,S3,S4,S5])

else:
  if A %10 == 0:
    S6 = A
  else:
    S6 = (A//10)*10+10
  if B %10 == 0:
    S6 = S6 + B
  else:
    S6 = S6 + (B//10)*10+10
  if C %10 == 0:
    S6 = S6 + C
  else:
    S6 = S6 + (C//10)*10+10
  if D %10 == 0:
    S6 = S6 + D
  else:
    S6 = S6 + (D//10)*10+10
  if E %10 == 0:
    S6 = S6 + E
  else:
    S6 = S6 + (E//10)*10+10
  print S6