#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Int = long long;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5);
  for (int(i) = 0; (i) < (int)(5); (i)++) cin >> a[i];
  int last = inf;
  for (int(i) = 0; (i) < (int)(5); (i)++) {
    if (a[i] % 10 != 0) {
      last = min(last, a[i] % 10);
    }
  }
  int ans = 0;
  for (int(i) = 0; (i) < (int)(5); (i)++) {
    if (a[i] % 10 != 0) {
      ans += a[i] + (10 - a[i] % 10);
    } else {
      ans += a[i];
    }
  }
  cout << ans - 10 + last;
}
