#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 7;
const int mod = 1e9 + 7;
const long long INF = 9223372036854775807;
long long dp[maxn][maxn];
int par[maxn];
int main() {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (int i = 1; i <= n; i++) {
    par[i] = par[i - 1] + dp[0][i];
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j == b) {
        continue;
      }
      if (j < b) {
        int mid = (j + b - 1) / 2;
        dp[i][j] = par[mid] - dp[i - 1][j];
      }
      if (j > b) {
        int mid = (j + b + 0) / 2;
        dp[i][j] = par[n] - par[mid] - dp[i - 1][j];
      }
      dp[i][j] += mod;
      dp[i][j] += mod;
      dp[i][j] %= mod;
    }
    for (int j = 1; j <= n; j++) {
      par[j] = par[j - 1] + dp[i][j];
      par[j] %= mod;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[k][i];
    ans %= mod;
  }
  cout << ans << endl;
}
