#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> a(5);
  for (int i = 0; i < (5); ++i) cin >> a[i];
  int mx = -1, ans = 0;
  for (int i = 0; i < (5); ++i) {
    ans += a[i];
    int x = a[i] % 10;
    if (x == 0) continue;
    x = 10 - x;
    ans += x;
    mx = max(mx, x);
  }
  ans -= mx;
  cout << ans << endl;
  return 0;
}
