#include <bits/stdc++.h>
using namespace std;
long long maxn = -1e18;
long long minn = 1e18;
long long mod = 1000000007;
long long ans = 0;
long long cur = 0;
long long tong = 0, tong2 = 0;
long long cnt = 0;
long long k, l;
string s;
long long n, m, x, y;
long long b[100005];
long long was[200005];
bool flag = true;
vector<long long> node[200005];
long long dp[105][105];
long long a[55];
long long c[55];
map<string, int> ok;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a[2] >> a[3] >> a[5] >> a[6];
  cout << min(a[2], min(a[5], a[6])) * 256 +
              min(a[2] - min(a[2], min(a[5], a[6])), a[3]) * 32;
}
