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