#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  vector<int> a(5);
  int ans = 0, Min = INT_MAX;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0) {
      ans += a[i];
    } else {
      ans += a[i] - a[i] % 10 + 10;
      Min = min(Min, a[i] % 10);
    }
  }
  cout << ans + Min - 10 << endl;
  return 0;
}
