#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e+9 + 7;
const int LIM = 5005;
int dp[LIM][LIM];
int sum[LIM];
int bad[LIM];
int main() {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  if (a < b) {
    n = b - 2;
    --a;
    a = n - a;
  } else {
    a = a - b - 1;
    n = n - b - 1;
  }
  dp[0][a] = 1;
  for (int i = 0; i < k; ++i) {
    sum[0] = dp[i][0];
    for (int j = 1; j <= n; ++j) {
      sum[j] = sum[j - 1] + dp[i][j];
      if (sum[j] >= MOD) sum[j] -= MOD;
    }
    for (int j = 0; j <= n; ++j) {
      dp[i + 1][j] = sum[n] - sum[max((j - 1) / 2, 0)];
      if (dp[i + 1][j] < 0) dp[i + 1][j] += MOD;
      if (j != 0) dp[i + 1][j] -= dp[i][j];
      if (dp[i + 1][j] < 0) dp[i + 1][j] += MOD;
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    ans += dp[k][i];
    if (ans >= MOD) ans -= MOD;
  }
  cout << ans;
  return 0;
}
