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