#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 29);
const int maxn = 5010;
const long long p = 1000000007;
long long n, a, b, k;
long long dp[maxn][maxn];
long long sum[maxn];
int main() {
  while (cin >> n >> a >> b >> k) {
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; i++)
      dp[1][i] = (abs(a - i) < abs(a - b)) && (i != a);
    sum[0] = 0;
    for (int i = 1; i <= n; i++) sum[i] = (sum[i - 1] + dp[1][i]) % p;
    for (int i = 2; i <= k; i++) {
      for (int j = 1; j <= n; j++) {
        if (j < b) {
          dp[i][j] = (dp[i][j] + (sum[(b + j - 1) / 2] - sum[0] -
                                  (sum[j] - sum[j - 1]) + 3 * p) %
                                     p) %
                     p;
        } else if (j > b) {
          dp[i][j] = (dp[i][j] + (sum[n] - sum[(b + j) / 2] -
                                  (sum[j] - sum[j - 1]) + 3 * p) %
                                     p) %
                     p;
        }
      }
      for (int j = 1; j <= n; j++) {
        sum[j] = (sum[j - 1] + dp[i][j] % p) % p;
      }
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      ans = (ans % p + dp[k][i] % p) % p;
    }
    cout << ans << endl;
  }
  return 0;
}
