#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long sum = 0, ma = -1;
  for (long long i = 0; i < 5; i++) {
    long long a;
    cin >> a;
    if (a % 10) ma = max(ma, 10 - a % 10);
    sum += (a + 9) / 10 * 10;
  }
  cout << sum - ma << endl;
}
