#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
signed main() {
  long long a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  long long ans = 0;
  ans += a;
  while (ans % 10 != 0) ans++;
  ans += b;
  while (ans % 10 != 0) ans++;
  ans += c;
  while (ans % 10 != 0) ans++;
  ans += d;
  while (ans % 10 != 0) ans++;
  ans += e;
  while (ans % 10 != 0) ans++;
  long long mx = 0;
  if (a % 10 != 0) mx = max(mx, 10 - a % 10);
  if (b % 10 != 0) mx = max(mx, 10 - b % 10);
  if (c % 10 != 0) mx = max(mx, 10 - d % 10);
  if (d % 10 != 0) mx = max(mx, 10 - d % 10);
  if (e % 10 != 0) mx = max(mx, 10 - e % 10);
  ans -= mx;
  cout << ans << endl;
  return 0;
}
