#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int rm = 9;
  int arg = -1;
  vector<int> tmp(5);
  for (int i = 0; i < 5; ++i) {
    cin >> a;
    tmp[i] = a;
    int trm = a % 10;
    if (trm > 0 & trm < rm) {
      arg = i;
      rm = trm;
    }
  }
  int ret = 0;
  for (int i = 0; i < 5; ++i) {
    a = tmp[i];
    if (i == arg) {
      ret += a;
    } else {
      int trm = a % 10;
      int keta = a / 10;
      if (trm > 0) keta += 1;
      ret += keta * 10;
    }
  }
  cout << ret << endl;
}
