#include <bits/stdc++.h>
using namespace std;
const int SIZE = 5005;
const int MOD = 1000000007;
int N, A, B, K;
int dp[SIZE][SIZE];
void slv(int x, int l, int r, int d) {
  dp[x][l] += d;
  dp[x][l] %= MOD;
  dp[x][r] -= d;
  dp[x][r] = (dp[x][r] + MOD) % MOD;
}
int main() {
  scanf("%d %d %d %d", &N, &A, &B, &K);
  dp[0][A] = 1;
  for (int i = 0; i < K; i++) {
    for (int j = 1; j <= N; j++) {
      if (j == B) continue;
      int temp = abs(j - B) - 1;
      slv(i + 1, max(j - temp, 1), j, dp[i][j]);
      slv(i + 1, j + 1, min(j + temp + 1, N + 1), dp[i][j]);
    }
    int cnt = 0;
    for (int j = 1; j <= N; j++) {
      cnt += dp[i + 1][j];
      cnt %= MOD;
      dp[i + 1][j] = cnt;
    }
  }
  int res = 0 + 0;
  for (int i = 1; i <= N; i++) {
    if (i == B) continue;
    res += dp[K][i];
    res %= MOD;
  }
  printf("%d\n", res);
  return 0;
}
