#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,k1[5]={};
  cin >> a >> b >> c >> d >> e;
  k1[0]=(a%100)%10;
  k1[1]=(b%100)%10;
  k1[2]=(c%100)%10;
  k1[3]=(d%100)%10;
  k1[4]=(e%100)%10;
  sort(k1,k1+5,greater<int>);
  for(int i=0;i<5;i++){
    if(k1[i]==(a%100)%10)ans+=a+(10-k1[i]);
    if(k1[i]==(b%100)%10)ans+=b+(10-k1[i]);
    if(k1[i]==(c%100)%10)ans+=c+(10-k1[i]);
    if(k1[i]==(d%100)%10)ans+=d+(10-k1[i]);
    if(k1[i]==(e%100)%10)ans+=e+(10-k1[i]);
  }
  cout << ans << endl;
}
