#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
using namespace std;
const int mod = 1e9 + 7;
long long dp[5005][5005];
int main(void) {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= n; ++j)
      if (j != b && dp[i - 1][j]) {
        int cnt = abs(j - b) - 1;
        int p = max(1, j - cnt);
        int u = min(n, j + cnt) + 1;
        dp[i][p] += dp[i - 1][j];
        dp[i][j] -= dp[i - 1][j];
        dp[i][j + 1] += dp[i - 1][j];
        dp[i][u] -= dp[i - 1][j];
        dp[i][p] %= mod;
        dp[i][u] = (dp[i][u] + mod) % mod;
        dp[i][j + 1] %= mod;
        dp[i][j] = (dp[i][j] + mod) % mod;
      }
    for (int j = 1; j <= n; ++j)
      dp[i][j] += dp[i][j - 1], dp[i][j] = (dp[i][j] + mod) % mod;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += dp[k][i], ans %= mod;
  return cout << ans << '\n', 0;
}
