#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD7 = (int)1e9 + 7;
template <class T1, class T2>
int upmin(T1 &x, T2 v) {
  if (x > v) {
    x = v;
    return 1;
  }
  return 0;
}
template <class T1, class T2>
int upmax(T1 &x, T2 v) {
  if (x < v) {
    x = v;
    return 1;
  }
  return 0;
}
int two, three, five, six;
void init() { cin >> two >> three >> five >> six; }
void preprocess() {}
void solve() {
  int ans = min({two, five, six}) * 256;
  two -= min({two, five, six});
  ans += min(two, three) * 32;
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  init();
  preprocess();
  solve();
  return 0;
}
