#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;
    if (temp % 10 != 0)
      arr[i] = 10 - temp % 10;
    else
      arr[i] = 0;
  }
  sort(arr + 1, arr + 6);
  for (int i = 1; i <= 4; i++) sum += arr[i];
  cout << sum;
}
