#include <bits/stdc++.h>
using namespace std;
int n, h[100005];
long long dp[100005];
int main() {
  int N, M, K;
  std::vector<long long> c(5);
  std::vector<long long> v(5);
  for (long long i = 0; i < 5; i++) {
    std::cin >> c[i];
  }
  int work;
  for (long long i = 0; i < 5; i++) {
    v[i] = c[i] % 10;
  }
  int min;
  int min_inde;
  min = 1000;
  for (long long i = 0; i < 5; i++) {
    if (v[i] != 0 && v[i] <= min) {
      min = v[i];
      min_inde = i;
    }
  }
  int sum;
  sum = 0;
  for (long long i = 0; i < 5; i++) {
    if (i != min_inde) {
      if (v[i] != 0) {
        sum += c[i] + (10 - v[i]);
      } else {
        sum += c[i];
      }
    }
  }
  printf("%lld", sum + c[min_inde]);
  return 0;
}
