#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int a[5];
  long long int ans = 0;
  long long int m = 10;
  long long int d = 0;
  for (long long int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) {
      if (a[i] % 10 < m) {
        m = a[i] % 10;
        d = i;
      }
    }
  }
  if (m != 10) {
    for (long long int i = 0; i < 5; i++) {
      if (i != d && a[i] % 10 != 0) {
        ans += (a[i] + 10 - a[i] % 10);
      } else if (i != d) {
        ans += a[i];
      }
    }
  }
  cout << ans + a[d] << "\n";
  return 0;
}
