#include <bits/stdc++.h>
using namespace std;
int main() {
  int low = 9, total = 0;
  for (int i = 0, k; i < 5; i++) {
    cin >> k;
    if (k % 10 != 0) {
      total += (k / 10) * 10 + 10;
      low = min(low, k % 10);
    } else {
      total += k;
    }
  }
  cout << total - 10 + low << endl;
}
