#include <bits/stdc++.h>
using namespace std;
int n;
long long a, b, c;
int dp[100];
void bfs() {
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    if (now + 1 <= 6 && dp[now + 1] > dp[now] + a) {
      dp[now + 1] = dp[now] + a;
      q.push(now + 1);
    }
    if (now + 2 <= 6 && dp[now + 2] > dp[now] + b) {
      dp[now + 2] = dp[now] + b;
      q.push(now + 2);
    }
    if (now + 3 <= 6 && dp[now + 3] > dp[now] + c) {
      dp[now + 3] = dp[now] + c;
      q.push(now + 3);
    }
  }
}
int main() {
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  scanf("%d%I64d%I64d%I64d", &n, &a, &b, &c);
  dp[0] = 0;
  int i;
  for (i = 1; i <= 70; i++) {
    int j;
    for (j = 0; j <= 60; j++) {
      if (j + 1 <= 60 && dp[j] + a < dp[j + 1]) {
        dp[j + 1] = dp[j] + a;
      }
      if (j + 2 <= 60 && dp[j] + b < dp[j + 2]) {
        dp[j + 2] = dp[j] + b;
      }
      if (j + 3 <= 60 && dp[j] + c < dp[j + 3]) {
        dp[j + 3] = dp[j] + c;
      }
    }
  }
  long long ans = 0x3f3f3f3f;
  for (i = 0; i <= 60; i++) {
    if ((n + i) % 4 == 0 && ans > dp[i]) {
      ans = dp[i];
    }
  }
  printf("%I64d", ans);
}
