#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000007;
const int N = 5005;
int dp[2][N], sum[2][N], n, a, b, k;
int main() {
  int i, j;
  scanf("%d %d %d %d", &n, &a, &b, &k);
  memset(dp, 0, sizeof(dp));
  memset(sum, 0, sizeof(sum));
  dp[0][a] = 1;
  for (i = 1; i <= n; i++) sum[0][i] = sum[0][i - 1] + dp[0][i];
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= n; j++) {
      if (j == b) continue;
      int pos1, pos2;
      if ((j + b) % 2 == 0) {
        pos1 = (j + b) / 2;
        pos2 = (j + b) / 2 - 1;
      } else {
        pos1 = (j + b) / 2;
        pos2 = (j + b) / 2;
      }
      if (j > b) {
        dp[i % 2][j] = (sum[1 - i % 2][n] - sum[1 - i % 2][pos1] + Mod) % Mod;
        if (j > pos1)
          dp[i % 2][j] = (dp[i % 2][j] - dp[1 - i % 2][j] + Mod) % Mod;
      } else {
        dp[i % 2][j] = (sum[1 - i % 2][pos2] + Mod) % Mod;
        if (j <= pos2)
          dp[i % 2][j] = (dp[i % 2][j] - dp[1 - i % 2][j] + Mod) % Mod;
      }
    }
    for (j = 1; j <= n; j++)
      sum[i % 2][j] = (sum[i % 2][j - 1] + dp[i % 2][j]) % Mod;
  }
  int ans = 0;
  for (i = 1; i <= n; i++) ans = (ans + dp[k % 2][i]) % Mod;
  printf("%d", ans);
  return 0;
}
