#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dish;
  for (int i = 0; i < 5; i++) {
    int k;
    cin >> k;
    dish.push_back(k);
  }
  int time = 0;
  for (int r = 0; r = 0; r--) {
    for (int i = 0; i < dish.size(); i++) {
      if ((dish[i]) % 10 == r) {
        time = time + dish[i];
        dish.erase(dish.begin() + i);
      }
    }
  }
  while (dish.size() > 1) {
    for (int r = 9; r >= 1; r--) {
      for (int i = 0; i < dish.size(); i++) {
        if (dish[i] % 10 == r) {
          time = time + dish[i] + 10 - r;
          dish.erase(dish.begin() + i);
        }
      }
    }
  }
  cout << time + dish[0];
  system("pause");
  return 0;
}
