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