#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long dp[5005], sum[5005];
int n, a, b, k, ans;
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  dp[a] = sum[a] = 1;
  for (int i = a + 1; i <= n; ++i) sum[i] = 1;
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= n; ++j)
      if (j < b)
        dp[j] = (sum[(j + b - 1) / 2] - sum[j] + sum[j - 1] + MOD) % MOD;
      else if (j > b)
        dp[j] =
            (sum[n] - sum[(j + b) / 2] + MOD - sum[j] + sum[j - 1] + MOD) % MOD;
      else
        dp[j] = 0;
    for (int j = 1; j <= n; ++j) sum[j] = (sum[j - 1] + dp[j]) % MOD;
  }
  for (int j = 1; j <= n; ++j) ans = (ans + dp[j]) % MOD;
  printf("%d\n", ans);
}
