#include <bits/stdc++.h>
using namespace std;
int main() {
  int now = 0;
  for (int i = 0; i < 4; i++) {
    int time;
    cin >> time;
    now += ceil(time / 10) * 10;
  }
  int time;
  cin >> time;
  now += time;
  cout << now << endl;
}
