#include <bits/stdc++.h>
using namespace std;
int a[5], ans, f, mina = 10, c;
int main() {
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    f = a[i] % 10;
    ans += a[i] + 10 - f;
    if (mina > f) mina = f, c = i;
  }
  cout << ans - 10 + a[c] % 10 << endl;
}
