#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5003;
const int MOD = 1000000007;
int n, a, b, k;
int dp[MAXN][MAXN];
int ADD(long long a, long long b) { return (a + b) % MOD; }
int SUB(long long a, long long b) { return (a - b + MOD) % MOD; }
void fill_dp() {
  for (int i = 1; i <= n; ++i) {
    dp[0][i] = i;
  }
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= n; ++j) {
      int lo = max(j - abs(j - b), 0);
      int hi = min(j + abs(j - b) - 1, n);
      dp[i][j] = ADD(dp[i][j - 1], SUB(SUB(dp[i - 1][hi], dp[i - 1][lo]),
                                       SUB(dp[i - 1][j], dp[i - 1][j - 1])));
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  fill_dp();
  printf("%d\n", SUB(dp[k][a], dp[k][a - 1]));
}
