#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007, n, a, b, k, dp[5010][5010];
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  if (a != b - 1 && a != b + 1) dp[0][a] = 1;
  for (int i = 1; i <= n; i++) dp[0][i] = dp[0][i] + dp[0][i - 1];
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j < b) {
        dp[i][j] = (dp[i - 1][(j + b - 1) / 2] -
                    ((dp[i - 1][j] - dp[i - 1][j - 1] + mod) % mod) + mod) %
                   mod;
      } else if (j > b) {
        dp[i][j] =
            (((dp[i - 1][n] - dp[i - 1][j - (j - b - 1) / 2 - 1] + mod) % mod) -
             ((dp[i - 1][j] - dp[i - 1][j - 1] + mod) % mod) + mod) %
            mod;
      }
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
    }
  }
  printf("%d\n", dp[k][n]);
  return 0;
}
