#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a[5];
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
  }
  ll b[5];
  ll mina = 10;
  int indexa = -1;
  for (int j = 0; j < 5; ++j) {
    ll b = a[j] % 10;
    if (b == 0) b = 10;
    if (b < mina) {
      mina = b;
      indexa = j;
    }
  }
  ll res = 0;
  for (int k = 0; k < 5; ++k) {
    if (k == indexa) continue;
    res += a[k];
    if (a[k] % 10 != 0) res += 10 - a[k] % 10;
  }
  res += a[indexa];
  cout << res << endl;
}
