#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int N = 5e3 + 5;
const long long int mod = 1e9 + 7;
const long long int inf = 1e9 + 9;
long long int dp[N][N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, a, b, k;
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (long long int i = 0; i < k; i++) {
    for (long long int j = 1; j <= n; j++) {
      if (!dp[i][j] || (j >= b - 1 && j <= b + 1)) continue;
      long long int d = abs(b - j);
      long long int mi = max(0LL, j - d + 1);
      long long int mx = min(n + 1, j + d);
      dp[i + 1][mi] = (dp[i + 1][mi] + dp[i][j]) % mod;
      dp[i + 1][j] = (dp[i + 1][j] - dp[i][j] + mod) % mod;
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % mod;
      dp[i + 1][mx] = (dp[i + 1][mx] - dp[i][j] + mod) % mod;
    }
    for (long long int j = 1; j <= n; j++)
      dp[i + 1][j] = (dp[i + 1][j] + dp[i + 1][j - 1]) % mod;
  }
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) ans = (ans + dp[k][i]) % mod;
  cout << ans;
  return 0;
}
