#include <bits/stdc++.h>
using namespace std;
int main() {
  int time[5];
  int ans = 0;
  int min_id = -1;
  int min_num = 9;
  for (int i = 0; i < 5; i++) {
    cin >> time[i];
    if (min_num >= time[i] % 10) {
      min_id = i;
      min_num = time[i] % 10;
    }
  }
  swap(time[4], time[min_id]);
  for (int i = 0; i < 5; i++) {
    ans += time[i];
    if (i != 4) ans = (ans + 9) / 10 * 10;
  }
  cout << ans << endl;
}
