#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int a[5];
  for (int i = 0; i < (5); ++i) cin >> a[i];
  int ans = 0;
  int hasu = 9;
  for (int i = 0; i < (5); ++i) {
    ans += (a[i] + 9) / 10 * 10;
    if (a[i] % 10 != 0) {
      hasu = min(hasu, a[i] % 10);
    }
  }
  cout << ans + (hasu - 10) << endl;
  return 0;
}
