#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5], min = 10, b;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (min > a[i] % 10 && a[i] % 10 != 0) {
      min = a[i] % 10;
      b = a[i];
    }
  }
  int max = 0;
  for (int i = 0; i < 5; i++) {
    if (b == a[i])
      max += b;
    else {
      if (a[i] % 10 > 0)
        max += a[i] - a[i] % 10 + 10;
      else
        max += a[i];
    }
  }
  cout << max;
}
