#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct edge {
  int to;
  ll cost;
};
const int inf = 2147483647;
int main() {
  int a[5], ans = 0, c = inf;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) c = min(c, a[i] % 10);
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 != 0) a[i] += 10 - a[i] % 10;
    ans += a[i];
  }
  cout << ans + c - 10 << endl;
  return 0;
}
