#include <bits/stdc++.h>
using namespace std;
int main() {
  int t[5], mint = 100000;
  for (int i = 0; i < (5); i++) {
    cin >> t[i];
    if (t[i] % 10) mint = min(mint, t[i] % 10);
  }
  int j, sum = 0;
  for (int i = 0; i < (5); i++) {
    if (t[i] % 10 != 0)
      j = (t[i] / 10 + 1) * 10;
    else
      j = t[i];
    sum += j;
  }
  cout << sum - (10 - mint) << endl;
}
