#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 5;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  int f = 10;
  for (int i = 0; i < (n); i++) {
    if (a[i] % 10 != 0) {
      int b = a[i] % 10;
      f = min(f, b);
    }
  }
  if (f == 10) {
    f = 0;
  }
  int ans = 0;
  for (int i = 0; i < (n); i++) {
    if (a[i] % 10 == 0) {
      ans += a[i];
    } else {
      ans += (a[i] / 10) * 10 + 10;
    }
  }
  if (f == 0) {
    cout << ans << endl;
  } else {
    cout << ans + 10 - f << endl;
  }
  return 0;
}
