#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long x = 0, y = 0, z = 0, w = 0, n = 0, m = 0, a = 0, b = 0;
  std::vector<long long> v(5);
  for (long long i = 0; i < (long long)(5); ++i) {
    std::cin >> v[i];
    if (v[i] % 10 > 0) {
      y = 10 - v[i] % 10;
      if (i == 0)
        x = y;
      else if (x < v[i] % 10)
        x = y;
      v[i] += y;
    }
    z += v[i];
  }
  std::cout << z - x << '\n';
  return 0;
}
