#include<bits/stdc++.h>
using namespace std;

int main(){
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = A%10;
  int b = B%10;
  int c = C%10;
  int d = D%10;
  int e = E%10;
  int xd = min({a,b,c,d,e});
    
  int A1 = A/10;
  int AA = A1*10+10;
  int B1 = B/10;
  int BB = B1*10+10;
  int C1 = C/10;
  int CC = C1*10+10;
  int D1 = D/10;
  int DD = D1*10+10;
  int E1 = E/10;
  int EE = E1*10+10;
  
  if(xd != 0){
    int ans = AA+BB+CC+DD+EE+xd-10;
    cout << ans <<endl;
  }
  else if(xc !=0){
    int ans = AA+BB+CC+DD+EE+xc-10;
    cout << ans <<endl;
  }
  else if(xb !=0){
    int ans = AA+BB+CC+DD+EE+xb-10;
    cout << ans <<endl;
  }
  else if(xa !=0){
    int ans = AA+BB+CC+DD+EE+xa-10;
    cout << ans <<endl;
  }
  else{
    int ans = A+B+C+D+E;
    cout << ans <<endl;
  }
}