#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int main() {
  int a[5];
  int ans = 0;
  for (int i = (int)(0); i < (int)(5); ++i) {
    cin >> a[i];
    ans += (a[i] + 9) / 10 * 10;
  }
  int ma = 0;
  for (int i = (int)(0); i < (int)(5); ++i) ma = max(a[i] % 10, ma);
  cout << ans - ma << endl;
  return 0;
}
