#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int min = 10;
  int time = 0;
  for (int i = 0; i < 5; i++) {
    int oneplace = a[i] % 10;
    time += a[i] + (10 - oneplace) % 10;
    if (oneplace != 0 && oneplace < min) min = i;
  }
  int oneplace = a[min] % 10;
  time -= (10 - oneplace) % 10;
  cout << time << endl;
  return 0;
}
