#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int t = 10;
  int tmp;
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    cin >> tmp;
    if (tmp % 10 == 0)
      ans += tmp;
    else {
      t = min(t, tmp % 10);
      ans += tmp / 10 * 10 + 10;
    }
  }
  if (t == 10) t = 0;
  cout << ans - 10 + t << endl;
  return 0;
}
