#include <bits/stdc++.h>
using namespace std;

int main() {
  int total = 0;
  int max_diff = 0;

  for (int i = 0; i < 5; i++) {
    int t;
    cin >> t;

    int ceil_t = ((t + 9) / 10) * 10;
    total += ceil_t;
    max_diff = max(max_diff, ceil_t - t);
  }

  cout << total - max_diff << endl;
}