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