#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int b[10];
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    sum += a / 10 * 10;
    b[i] = a % 10;
  }
  int p = 0;
  int min = 125;
  for (int i = 0; i < 5; i++) {
    if (b[i] == 0) p++;
    if (b[i] != 0 && b[i] < min) min = b[i];
  }
  cout << sum + (4 - p) * 10 + min << endl;
}
