#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <functional>
using namespace std;

int findACGT(char c){
  if (c=='A'||c=='C'||c=='T'||c=='G') return 1;
  else return 0;
}

int main() {
  int time[5];
  int q[5];
  for(int i=0;i<5;i++){
    cin >> time[i];
    q[i] = time[i]%10;
  }
  std::sort(q.begin(),q.end());
  int i=0;
  for (;i<5;i++){
    if(time[i]%10==q[4]) break;
  }
  int sum=0;
  for (int j=0;j<5;j++){
    sum+=(q[j]+1)*10;
  }
  cout << sum - ((time[i]%10)+1)*10 + time[i] << endl;
  
}

