#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  float a[5];
  for (int i = (0); i < (5); ++i) cin >> a[i];
  int lasti = 0;
  float lastn = (int)a[0] % 10;
  for (int i = (0); i < (4); ++i)
    if (lastn > (int)a[i + 1] % 10 and (int) a[i + 1] % 10 != 0) {
      lasti = i + 1;
      lastn = (int)a[i + 1] % 10;
    }
  int ans = 0;
  for (int i = (0); i < (5); ++i) {
    if (i == lasti)
      continue;
    else
      ans += (ceil(a[i] / 10) * 10);
  }
  ans += a[lasti];
  cout << ans << endl;
  ;
  return 0;
}
