#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int line[5];
  int pre = 0;
  bool a = true;
  for (int i = 0; i < 5; i++) {
    cin >> line[i];
    if (line[i] % 10 != 0) a = false;
  }
  if (!a) {
    pre = 9;
    for (int i = 0; i < 5; i++) {
      int b = min(pre, line[i] % 10);
      if (b != 0) pre = b;
    }
  }
  sort(line, line + 5);
  for (int i = 0; i < 5; i++) {
    ans += (line[i] - 1) / 10 + 1;
  }
  cout << ans * 10 - (10 - pre) << endl;
}
