#include <bits/stdc++.h>
using namespace std;
static const int MAX = 100;
int main() {
  int dish[5], time = 0, x, t = 987654321;
  for (int i = 0; i < (int)(5); i++) cin >> dish[i];
  x = 9;
  for (int i = 0; i < (int)(5); i++) {
    if (x > dish[i] % 10 && dish[i] % 10 != 0) {
      x = dish[i] % 10;
      t = i;
    }
  }
  for (int i = 0; i < (int)(5); i++) {
    if (i == t) continue;
    if (dish[i] % 10 == 0)
      time += dish[i];
    else
      time += (dish[i] / 10 + 1) * 10;
  }
  cout << time + dish[t] << endl;
}
