#include <bits/stdc++.h>
using namespace std;
long long ans, dp[2][5050], sum[2][5050];
int main() {
  int n, a, b, k, i, j, dist, mod = 1e9 + 7;
  cin >> n >> a >> b >> k;
  if (a > b) {
    a = n - a + 1;
    b = n - b + 1;
  }
  dp[0][a] = 1;
  for (i = a; i < b; ++i) sum[0][i] = 1;
  for (j = 1; j <= k; ++j) {
    for (i = 1; i < b; ++i) {
      dist = (b - i - 1) / 2;
      dp[j & 1][i] =
          ((sum[(j - 1) & 1][i + dist] - dp[(j - 1) & 1][i]) % mod + mod) % mod;
      sum[j & 1][i] = (sum[j & 1][i - 1] + dp[j & 1][i]) % mod;
    }
  }
  for (i = 1; i < b; ++i) ans = (ans + dp[k & 1][i]) % mod;
  cout << ans << endl;
  return 0;
}
