#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> time(5);
  int min_surp = 10;
  int result = 0;
  int last = 0;
  for (int i = 0; i < 5; i++) {
    cin >> time[i];
    if (time[i] % 10 != 0 && min_surp > time[i] % 10) {
      last = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (last == i) {
      result += time[i];
    } else {
      if (time[i] % 10 == 0) {
        result += time[i];
      } else {
        result += time[i] + (10 - time[i] % 10);
      }
    }
  }
  cout << result << endl;
}
