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

int main(){
  int d[5],total = 0;
  for(int i = 0; i < 5; i++) {
    cin >> d[i];
    total += ((d[i] + 9) / 10) * 10;
  }
  int final = 0;
  for(int i = 0; i < 5; i++){
    final = max(final, ((d[i] + 9) / 10) * 10 - d[i]);
  }
  cout << total - final << endl;
}
