#include <bits/stdc++.h>
using namespace std;
long long int n, a, b, k;
const int MOD = (long long int)1e9 + 7;
long long int dp[5432][5432];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> a >> b >> k;
  if (a < b) {
    a = n - a + 1;
    b = n - b + 1;
  }
  for (int i = a; i <= n; i += 1) {
    dp[0][i] = 1;
  }
  for (int i = 1; i <= k; i += 1) {
    for (int j = b + 1; j <= n; j += 1) {
      dp[i][j] += dp[i][j - 1];
      dp[i][j] += (dp[i - 1][n] - dp[i - 1][j]);
      dp[i][j] += (dp[i - 1][j - 1] - dp[i - 1][(j + b) / 2]);
      dp[i][j] += MOD;
      dp[i][j] %= MOD;
    }
  }
  cout << dp[k][n] << endl;
  return 0;
}
