#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a[5];
  long long ans = 0;
  long long ansans = 650;
  for (long long i = 0; i < (5); i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < (5); i++) {
    for (long long j = 0; j < (5); j++) {
      if (a[j] % 10 == 0) {
        ans += a[j];
      } else {
        ans += (a[j] / 10 + 1) * 10;
      }
      ans -= (10 - a[i] % 10);
    }
    ansans = min(ans, ansans);
  }
  cout << ansans << endl;
  return 0;
}
