import sys
def Main():
  A = int(input())
  B = int(input())
  C = int(input())
  D = int(input())
  E = int(input())
    

  Last = A
    
  if Last%10 > B%10:
    Last = B
    
  if Last%10 > C%10:
  	Last = C
      
  if Last%10 > D%10:
   	Last = D
      
  if Last%10 > E%10:
    Last = E
    
  BeforeTotal = (A/10+1)*10+(B/10+1)*10+(C/10+1)*10+(D/10+1)*10+(E/10+1)*10
  AfterTotal = BeforeTotal - (Last/10+1)*10 +Last
    
  print(int(AfterTotal))
    
Main()