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