#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 58;
const ll mod = 1000000007;
int main() {
  ios::sync_with_stdio(0);
  int n[5], k, ans = 0;
  int idx, maxi = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> n[i];
    if (maxi < abs(n[i] % 10 - 10) % 10) {
      maxi = abs(n[i] % 10 - 10) % 10;
      idx = i;
    }
    ans += n[i] + abs(n[i] % 10 - 10) % 10;
  }
  ans -= abs(n[idx] % 10 - 10) % 10;
  cout << ans << '\n';
  return 0;
}
