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