#include <iostream>

using namespace std;

int main() {
  int ans = 0;
  int min_time = 10;
  for (int i = 0; i < 5; i++) {
    int time;
    cin >> time;
    ans += (time + 9) / 10 * 10;
    min_time = min(min_time, (time - 1) % 10);
  }
  cout << ans - 10 + min_time + 1 << endl;
}
