#include <bits/stdc++.h>
using namespace std;
long long a[6];
long long b[6];
long long ans;
bool check = false;
long long nf;
int main() {
  long long n = 5;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    if (i == 1) {
      nf = a[i];
    }
    if (nf != a[i]) check = true;
    if (a[i] % 10 == 0)
      b[i] = 0;
    else
      b[i] = 10 - a[i] % 10;
  }
  if (check == false) {
    for (long long i = 1; i <= n; i++) {
      ans += a[i];
      if (i != n) {
        ans += 10 - a[i] % 10;
      }
      if (i == n) {
        cout << ans;
        return 0;
      }
    }
  }
  long long ma = 0;
  for (long long i = 1; i <= n; i++) {
    ma = max(b[i], ma);
  }
  for (long long i = 1; i <= n; i++) {
    if (ma != 10 - a[i] % 10) {
      if (a[i] % 10 == 0)
        ans += a[i];
      else
        ans = ans + a[i] + 10 - a[i] % 10;
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (ma == 10 - a[i] % 10) {
      ans += a[i];
      break;
    }
  }
  cout << ans;
  return 0;
}
