#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = 5e3 + 5, OO = 1e9;
int dp[N][N], a, b, k, n;
int main() {
  cin >> n >> a >> b >> k;
  for (int i = 1; i <= n; i++) dp[0][i] = i;
  for (int lev = 1; lev <= k; ++lev) {
    for (int pos = 1; pos <= n; ++pos) {
      if (pos == b) continue;
      int dif = abs(pos - b);
      int st = max(pos - dif + 1, 1);
      int en = min(pos + dif - 1, n);
      int inc = dp[lev - 1][en] - dp[lev - 1][st - 1];
      int ex = dp[lev - 1][pos] - dp[lev - 1][pos - 1];
      if (ex < 0) ex += 1000000007;
      if (inc < 0) inc += 1000000007;
      inc -= ex;
      if (inc < 0) inc += 1000000007;
      dp[lev][pos] = dp[lev][pos - 1] + inc;
      if (dp[lev][pos] >= 1000000007) dp[lev][pos] -= 1000000007;
    }
  }
  cout << (dp[k][a] - dp[k][a - 1] + 1000000007) % 1000000007;
  return 0;
}
