#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int tmp = 9;
  for (int i = 0; i < 5; i++) {
    int tmp2;
    cin >> tmp2;
    if (tmp2 % 10) {
      if ((tmp2 % 10) < tmp) {
        tmp = tmp2 % 10;
      }
      ans += ((tmp2 / 10) * 10 + 10);
    } else {
      ans += tmp2;
    }
  }
  cout << ans + tmp - 10 << endl;
  return 0;
}
