#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
signed main() {
  vector<long long> num(5);
  for (long long i = 0; i < 5; i++) {
    cin >> num.at(i);
  }
  long long ans = 0;
  long long mini = 10;
  for (long long i = 0; i < 5; i++) {
    if (num.at(i) % 10 != 0) {
      ans += (num.at(i) / 10 + 1) * 10;
      mini = min(mini, num.at(i) % 10);
    } else {
      ans += num.at(i);
    }
  }
  if (mini > 0) ans += mini % 10 - 10;
  cout << ans << endl;
  return 0;
}
