#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  int tfs, tt;
  tfs = min(k2, min(k5, k6));
  k2 -= tfs;
  tt = min(k2, k3);
  cout << (256 * tfs) + (32 * tt);
}
