#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 xa = min(a,b);
  int xb = min(xa,c);
  int xc = min(xb,d);
  int xd = min(xc,e);
  int ans = xd;
    
  int B1 = B/10;
  int BB = B1*10;
  int C1 = C/10;
  int CC = C1*10;
  int D1 = D/10;
  int DD = D1*10;
  int E1 = E/10;
  int EE = E1*10;
  int A1 = A/10;
  int AA = A1*10;
  
  int ans = AA+BB+CC+DD+EE+xd;
  
  cout << ans <<endl;
}