#include <bits/stdc++.h>
using namespace std;
int temp, sum = 0, arr[5];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 1; i <= 5; i++) {
    cin >> temp;
    sum += temp + (10 - temp % 10);
    arr[i] = 10 - temp % 10;
  }
  temp = max({arr[1], arr[2], arr[3], arr[4], arr[5]});
  sum -= temp;
  cout << sum;
}
