#include <bits/stdc++.h>
using namespace std;
long long int n, m, sum, k, a, b, dp[1000005], pref[1000005];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> a >> b >> k;
  for (int j = 0; j <= k; j++) {
    for (int i = 1; i <= n; i++) {
      if (j == 0) {
        dp[a] = 1;
        break;
      }
      long long int x = 0;
      if (a > b) {
        x = i - b - 1;
        x /= 2;
        dp[i] = pref[i - x] - dp[i];
        dp[i] += 1000000007;
        dp[i] %= 1000000007;
      } else {
        x = b - i - 1;
        x /= 2;
        dp[i] = pref[i + x] - dp[i];
        dp[i] += 1000000007;
        dp[i] %= 1000000007;
      }
    }
    if (a < b)
      for (int i = 1; i <= n; i++)
        pref[i] = pref[i - 1] + dp[i], pref[i] %= 1000000007;
    else
      for (int i = n; i >= 1; i--)
        pref[i] = pref[i + 1] + dp[i], pref[i] %= 1000000007;
  }
  if (a > b)
    for (int i = b + 1; i <= n; i++) sum += dp[i], sum %= 1000000007;
  else
    for (int i = 1; i <= b - 1; i++) sum += dp[i], sum %= 1000000007;
  cout << sum;
}
