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