#include <bits/stdc++.h>
using namespace std;
int main() {
  int time[5];
  int mark = 0, m = INT_MAX;
  ;
  for (int i = 0; i < (int)(5); i++) {
    cin >> time[i];
    if (time[i] % 10 != 0 && time[i] % 10 < m) {
      m = time[i] % 10;
      mark = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (i == mark)
      ans += time[i] / 10 * 10;
    else
      ans += (time[i] + 9) / 10 * 10;
  }
  cout << ans + m << endl;
}
