#include <bits/stdc++.h>
using namespace std;
int main() {
  int food[5];
  for (int i = 0; i < 5; i++) {
    cin >> food[i];
  }
  int near1 = 0;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 5; j++) {
      if (food[j] % 10 == i) {
        near1 = food[j];
        break;
      }
    }
    if (near1 != 0) {
      break;
    }
  }
  int count = 0;
  for (int i = 0; i < 5; i++) {
    if (near1 == food[i] && count == 0) {
      count++;
    } else {
      food[i] += 10 - food[i] % 10;
    }
  }
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += food[i];
  }
  cout << sum;
}
