#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 5, mod = 1000 * 1000 * 1000 + 7;
long long dp[N][N], ps[N];
int main() {
  long long n, a, b, k;
  cin >> n >> a >> b >> k;
  a--, b--;
  for (int i = 0; i < n; i++) {
    dp[0][i] = 1;
  }
  dp[0][b] = 0;
  for (int i = 0; i < n; i++) {
    ps[i + 1] = ps[i] + dp[0][i];
    ps[i + 1] %= mod;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < n; j++) {
      if (j < b) {
        dp[i][j] =
            (ps[b] - ps[j + 1]) + (ps[j] - ps[max(0 * 1ll, j - (b - j) + 1)]);
        dp[i][j] += 2 * mod;
        dp[i][j] %= mod;
      } else {
        dp[i][j] = (ps[j] - ps[b + 1]) + (ps[min(n, j + (j - b))] - ps[j + 1]);
        dp[i][j] += 2 * mod;
        dp[i][j] %= mod;
      }
    }
    ps[0] = 0;
    for (int j = 0; j < n; j++) {
      ps[j + 1] = ps[j] + dp[i][j];
      ps[j + 1] += 2 * mod;
      ps[j + 1] %= mod;
    }
  }
  cout << dp[k][a] % mod;
  return 0;
}
