#include <bits/stdc++.h>
using namespace std;
int a[6], sum, i, n;
int main() {
  cin >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
  sort(a + 1, a + 5 + 1);
  for (i = 5; i >= 1; i++) {
    while (n % 10 != 0) {
      sum += a[i];
    }
  }
  cout << sum;
  return 0;
}
