#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dishes(5);
  for (int i = 0; i < 5; i++) {
    cin >> dishes.at(i);
  }
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += dishes.at(i);
  }
  vector<int> x;
  for (int i = 0; i < 5; i++) {
    if (dishes.at(i) % 10 != 0) {
      x.at(i) = 10 - dishes.at(i) % 10;
    } else {
      x.at(i) = 0;
    }
  }
  sort(x.begin(), x.end());
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    for (;;) {
      if (dishes.at(i) % 10 == 0) {
        break;
      } else {
        dishes.at(i)++;
        ans++;
      }
    }
  }
  cout << sum + ans - x.at(4) << endl;
  return 0;
}
