#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int i = 0; i < (int)(5); i++) {
    cin >> a[i];
  }
  sort(a, a + 5);
  int b[5];
  int minmin = 0;
  for (int i = 0; i < 5; i++) {
    minmin = max(minmin, a[i] % 10);
  }
  int ans = 0, last = 0;
  bool ok = true;
  for (int i = 0; i < 5; i++) {
    if (minmin == a[i] % 10 && ok) {
      last = a[i];
      ok = false;
    } else {
      ans = ans + a[i] + (10 - a[i] % 10);
    }
  }
  cout << ans + last << endl;
}
