#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 5000 + 10;
long long dp[maxn][maxn], n, a, b, k, sum[maxn], ans;
int main() {
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + dp[0][i];
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j != b) {
        if (j > b) {
          int x = (j - b - 1) / 2;
          int r = j - x;
          int l = n;
          dp[i][j] += sum[l] - sum[r - 1];
          dp[i][j] %= mod;
          dp[i][j] -= dp[i - 1][j];
          dp[i][j] += mod;
          dp[i][j] %= mod;
        } else {
          int x = (b - j - 1) / 2;
          int l = j + x;
          int r = 1;
          dp[i][j] += sum[l] - sum[r - 1];
          dp[i][j] %= mod;
          dp[i][j] -= dp[i - 1][j];
          dp[i][j] += mod;
          dp[i][j] %= mod;
        }
      }
      if (i == k && j != b) {
        ans += dp[i][j];
        ans %= mod;
      }
    }
    sum[0] = 0;
    for (int j = 1; j <= n; j++) {
      sum[j] = sum[j - 1] + dp[i][j];
      sum[j] %= mod;
    }
  }
  ans += mod;
  ans %= mod;
  cout << ans << endl;
}
