#include <bits/stdc++.h>
using namespace std;
int main() {
  int time[5];
  int sum = 0, ans = 999;
  cin >> time[0] >> time[1] >> time[2] >> time[3] >> time[4];
  for (int i = 0; i < 5; i++) {
    int tmp = (time[i] + 10) - (time[i] % 10);
    sum += tmp;
  }
  for (int i = 0; i < 5; i++) {
    int tmp = sum;
    tmp -= (time[i] + 10) - (time[i] % 10);
    tmp += time[i];
    if (tmp < ans) {
      ans = tmp;
    }
  }
  cout << ans << endl;
}
