#include <bits/stdc++.h>
using namespace std;
bool f(int l, int r) { return l % 10 > r % 10; }
int main() {
  vector<int> a;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  int s = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) s += a[i];
  }
  sort(a.begin(), a.end(), f);
  a.push_back(0);
  for (int i = 0; i < 5; i++) {
    if (a[i + 1] % 10 != 0)
      s += a[i] / 10 * 10 + 10;
    else {
      s += a[i];
      break;
    }
  }
  cout << s;
}
