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