#include <bits/stdc++.h>
using namespace std;
int main() {
  int kazu[5], keisan[5], min, goukei, num, cnt;
  for (int i = 0; i < 5; i++) cin >> kazu[i];
  for (int i = 0; i < 5; i++) {
    keisan[i] = 10 - kazu[i] % 10;
    if (keisan[i] == 10) keisan[i] = 0;
  }
  min = 10;
  goukei = 0;
  for (int i = 0; i < 5; i++) {
    min = 10;
    for (int j = 0; j < 5; j++) {
      if (keisan[j] <= min) {
        cnt = j;
      }
    }
    keisan[cnt] = 100;
    num = 10 - kazu[cnt] % 10;
    if (num == 10) num = 0;
    if (i == 4) {
      goukei += kazu[cnt];
      break;
    }
    goukei += kazu[cnt] + num;
  }
  cout << goukei << endl;
}
