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