#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5010, mod = 1000000007;
int n, a, b, k;
int dp[MAXN], t[MAXN], suma[MAXN];
void postavi() {
  suma[0] = 0;
  for (int i = 1; i <= n; i++) suma[i] = (suma[i - 1] + dp[i]) % mod;
}
int upit(int poc, int kraj) {
  poc = max(1, poc);
  kraj = min(n, kraj);
  if (kraj < poc) return 0;
  return (((suma[kraj] - suma[poc - 1]) % mod) + mod) % mod;
}
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &k);
  dp[a] = 1;
  for (int i = 1; i <= k; i++) {
    postavi();
    for (int j = 1; j <= n; j++) {
      int razlika = abs(j - b);
      if (j < b) {
        t[j] = (t[j] + upit(1, j + ((razlika - 1) / 2))) % mod;
        t[j] = ((t[j] - dp[j]) % mod + mod) % mod;
      } else if (j > b) {
        t[j] = (t[j] + upit(j - (razlika - 1) / 2, n)) % mod;
        t[j] = ((t[j] - dp[j]) % mod + mod) % mod;
      }
    }
    for (int j = 1; j <= n; j++) {
      dp[j] = t[j];
      t[j] = 0;
    }
  }
  int rj = 0;
  for (int i = 1; i <= n; i++) rj = (rj + dp[i]) % mod;
  printf("%d\n", rj);
  return 0;
}
