#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int arr[5], diff[5], sum = 0, cnt = 0;
  for (int i = 0; i < 5; i++) cin >> arr[i], diff[i] = arr[i] % 10;
  sort(diff, diff + 5);
  for (int i = 0; i < 5; i++)
    if (arr[i] % 10 == 0) cnt++;
  for (int i = 0; i < 5; i++) sum += arr[i] - arr[i] % 10;
  for (int i = 4; i > cnt; i--)
    if (diff[i] != 0) sum += 10;
  cout << sum + diff[cnt];
  return 0;
}
