#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
  }
  int x = 0;
  int y = 100;
  for (int i = 0; i < 5; ++i) {
    if (a[i] % 10 != 0 && a[i] % 10 < y) {
      x = a[i];
      y = a[i] % 10;
    }
  }
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    int z = (a[i] + 9) / 10 * 10;
    sum += z;
  }
  int ans = 0;
  ans = sum - (x - x % 10 + 10) + x;
  cout << ans << endl;
}
