#include <bits/stdc++.h>
using namespace std;
int main() {
  int log, sum = 0, minnum = 10;
  vector<int> time(5);
  for (int i = 0; i < 5; i++) {
    cin >> time[i];
    if (time[i] % 10 == 0) {
      sum += time[i];
      time[i] = 0;
    } else {
      int a = time[i] % 10;
      if (a < minnum) {
        minnum = a;
        log = i;
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (i == log) {
      sum += time[i];
    } else {
      sum += time[i] + (10 - time[i] % 10);
    }
  }
  cout << sum << endl;
}
