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