#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long k2, k3, k5, k6, i, sum = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  long long mini = min(k2, min(k5, k6));
  sum = sum + mini * (256);
  k2 = k2 - mini;
  k5 = k5 - mini;
  k6 = k6 - mini;
  mini = min(k2, k3);
  sum = sum + mini * (32);
  cout << sum;
}
