#include <bits/stdc++.h>
using namespace std;
int a, b, n, k;
int dp[5003][5003], sum[5003][5003];
const int mod = (int)1e9 + 7;
int main() {
  int i, j;
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &k);
  for (i = 1; i <= n; i++) {
    if (i == b) continue;
    dp[i][0] = 1;
    sum[i][0] = dp[i][0] + sum[i - 1][0];
  }
  for (j = 1; j <= k; j++) {
    for (i = 1; i <= n; i++) {
      if (i == b) continue;
      int d = abs(i - b) - 1;
      dp[i][j] = ((long long)sum[min(i + d, n)][j - 1] -
                  sum[max(i - d - 1, 0)][j - 1] + mod) %
                 mod;
      dp[i][j] = ((long long)dp[i][j] - dp[i][j - 1] + mod) % mod;
      sum[i][j] = ((long long)sum[i - 1][j] + dp[i][j]) % mod;
    }
  }
  printf("%d\n", dp[a][k]);
  return 0;
}
