#include <bits/stdc++.h>
using namespace std;
const long MOD = 1e9 + 7;
long n, a, b, k;
long long f[5005][5005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b >> k;
  f[0][a] = 1;
  f[0][a + 1] -= 1;
  for (long i = 0; i <= k; i++) {
    for (long j = 1; j <= n; j++) f[i][j] = (f[i][j] + f[i][j - 1] + MOD) % MOD;
    f[i][b] = 0;
    for (long j = 1; j <= n; j++) {
      long t = abs(j - b);
      f[i + 1][max((long)1, j - t + 1)] += f[i][j];
      f[i + 1][max((long)1, j - t + 1)] %= MOD;
      f[i + 1][min(n + 1, j + t)] -= f[i][j];
      f[i + 1][min(n + 1, j + t)] += MOD;
      f[i + 1][min(n + 1, j + t)] %= MOD;
      f[i + 1][j] -= f[i][j];
      f[i + 1][j] += MOD;
      f[i + 1][j] %= MOD;
      f[i + 1][j + 1] += f[i][j];
      f[i + 1][j + 1] %= MOD;
    }
  }
  long res = 0;
  for (long i = 1; i <= n; i++) {
    if (i != b) res = (res + f[k][i] + MOD) % MOD;
  }
  cout << res;
  return 0;
}
