#include <bits/stdc++.h>
using namespace std;
const int lmt = 5e3 + 10;
const long long mod = 1e9 + 7;
long long dp[lmt][lmt], n, a, b, k, pre[lmt];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (int i = 1; i <= n; i++) pre[i] = (pre[i - 1] + dp[0][i] + mod) % mod;
  for (int turn = 1; turn <= k; turn++) {
    for (int i = 1; i <= n; i++) {
      if (i == b) continue;
      if (i < b) {
        int x = (i + b) >> 1;
        if (abs(i - x) < abs(x - b) && i < x) {
          dp[turn][i] = (pre[x] - dp[turn - 1][i] + mod) % mod;
        } else if (abs(i - (x - 1)) < abs((x - 1) - b) && i < x - 1) {
          dp[turn][i] = (pre[x - 1] - dp[turn - 1][i] + mod) % mod;
        } else {
          dp[turn][i] = (pre[i - 1] + mod) % mod;
        }
      } else {
        int x = (i + b) >> 1;
        if (abs(i - x) < abs(x - b) && x < i) {
          dp[turn][i] = (pre[n] - pre[x - 1] - dp[turn - 1][i] + mod) % mod;
        } else if (abs(i - (x + 1)) < abs((x + 1) - b) && x + 1 < i) {
          dp[turn][i] = (pre[n] - pre[x] - dp[turn - 1][i] + mod) % mod;
        } else {
          dp[turn][i] = (pre[n] - pre[i] + mod) % mod;
        }
      }
    }
    for (int i = 1; i <= n; i++)
      pre[i] = (pre[i - 1] + dp[turn][i] + mod) % mod;
  }
  cout << pre[n] << "\n";
  return 0;
}
