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