#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MOD = INF + 7;
using P = pair<long long, long long>;
signed main() {
  long long a[5];
  for (long long(i) = 0; (i) < (5); ++(i)) cin >> a[i];
  long long ans = 0;
  long long MAX = -1;
  for (long long(i) = 0; (i) < (5); ++(i)) {
    ans += a[i];
    if (a[i] % 10) {
      ans += 10 - a[i] % 10;
      MAX = max(MAX, 10 - a[i] % 10);
    }
  }
  cout << (ans - MAX) << endl;
  ;
}
