#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
int main() {
  vll a(5);
  vll b(5);
  long long ans = 0;
  for (long long i = 0; i < (5); i++) {
    cin >> a[i];
    ans += a[i];
    b[i] = 10 - a[i] % 10;
  }
  sort((b).begin(), (b).end());
  for (long long i = 0; i < (4); i++) {
    if (b[i] != 10) ans += b[i];
  }
  cout << (ans) << endl;
}
