#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int time = 0;
  int tmp = 0;
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 5; i++) {
    if (i == 4) {
      time += a[i];
    } else {
      time += a[i];
      tmp = (time / 10 + 1) * 10;
      time = tmp;
    }
  }
  return 0;
}
