#include <bits/stdc++.h>
using namespace std;
long long mod = 1918;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, e, k, x = 0, p, y = 200, ans = 0, m = 0;
  bool b[5] = {false};
  long long a[5];
  for (i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0) {
      ans += a[i];
      b[i] = true;
    } else
      y = min(y, a[i] % 10);
  }
  for (i = 0; i < 5; i++) {
    if (b[i] == false) {
      ans += a[i];
      while (ans % 10 != 0) ans++;
    }
  }
  cout << ans - (10 - y);
  return 0;
}
