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