#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int count = 0;
  int lst = 10;
  vector<int> v(4);
  for (int i = 0; i < 5; ++i) {
    cin >> v[i];
  }
  for (int i = 0; i < 5; ++i) {
    if (v[i] % 10 == 0) {
      ans += v[i];
      v[i] = 9;
    } else {
      ans += v[i] + 10 - v[i] % 10;
    }
    lst = min(lst, v[i] % 10);
  }
  if (lst != 0) ans -= 10 - lst;
  cout << ans << endl;
}
