#include <bits/stdc++.h>
using namespace std;
void in() {}
long long int dp[5555][5555], sum[5555], mod = 1e9 + 7;
int n, k, a, b, md;
int main() {
  in();
  scanf("%d%d%d%d", &n, &a, &b, &k);
  for (int i = 1; i <= n; ++i) dp[0][i] = 1, sum[i] = i;
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (j == b) continue;
      if (j > b) {
        md = j - b - 1;
        dp[i][j] = sum[min(j + md, n)] - sum[max(j - md - 1, 0)];
        dp[i][j] -= dp[i - 1][j];
      } else if (j < b) {
        md = b - j - 1;
        dp[i][j] = sum[min(j + md, n)] - sum[max(j - md - 1, 0)];
        dp[i][j] -= dp[i - 1][j];
      }
      dp[i][j] %= mod;
      if (dp[i][j] < 0) dp[i][j] += mod;
    }
    sum[0] = 0;
    for (int j = 1; j <= n; ++j) {
      sum[j] = sum[j - 1] + dp[i][j];
      sum[j] %= mod;
    }
  }
  cout << dp[k][a] % mod << endl;
  return 0;
}
