#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(5);
  for (int i = 0; i < (5); i++) cin >> v[i];
  int ans = 0;
  int m = 0;
  for (int i = 0; i < (5); i++) {
    ans += (((v[i]) + (10) - 1) / (10)) * 10;
    if (v[i] % 10 != 0 && 10 - v[i] % 10 >= m) {
      m = 10 - v[i] % 10;
    }
  }
  cout << ans - 10 + m << endl;
  return 0;
}
