#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dish(5);
  for (int i = 0; i < 5; i++) {
    cin >> dish[i];
  }
  int x = 0;
  for (int i = 0; i < 5; i++) {
    if (x % 10 == 0) {
      x += dish[i];
    } else {
      x += (10 - x % 10) + dish[i];
    }
  }
  cout << x << endl;
}
