#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long gcd(long long x, long long y) { return (y == 0) ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int main() {
  int a, ans = 0, tmp = 10;
  bool b = true;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    if (a % 10 != 0) {
      tmp = min(tmp, a % 10);
      a += (10 - a % 10);
      b = false;
    }
    ans += a;
  }
  if (b) tmp = 0;
  cout << ans - (10 - tmp) << endl;
  return 0;
}
