#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
const int mod = 1000000007;
int d[maxn], d2[maxn];
int e[maxn], e2[maxn];
int main() {
  int n, a, b, m;
  cin >> n >> a >> b >> m;
  if (a == b) {
    cout << 0;
    return 0;
  }
  int ans = 0;
  if (a < b) {
    d[a] = 1;
    for (int i = 0; i <= m; i++) {
      for (int j = 1; j < b; j++) {
        e[j] = (e[j] + e[j - 1]) % mod;
        d[j] = (d[j] + e[j]) % mod;
        if (i == m) {
          ans = (ans + d[j]) % mod;
          continue;
        }
        if (j != b - 1) {
          if (j == 1)
            e2[2] = (e2[2] + d[j]) % mod;
          else {
            d2[j] = (d2[j] - d[j]);
            if (d2[j] < 0) d2[j] += mod;
            if (j - (b - j - 1) > 1)
              e2[j - (b - j - 1)] = (e2[j - (b - j - 1)] + d[j]) % mod;
            else
              e2[1] = (e2[1] + d[j]) % mod;
          }
        }
      }
      for (int j = 1; j < b; j++) {
        d[j] = d2[j], e[j] = e2[j];
        d2[j] = e2[j] = 0;
      }
    }
    cout << ans;
    return 0;
  }
  d[a] = 1;
  for (int i = 0; i <= m; i++) {
    for (int j = n; j > b; j--) {
      e[j] = (e[j] + e[j + 1]) % mod;
      d[j] = (d[j] + e[j]) % mod;
      if (i == m) {
        ans = (ans + d[j]) % mod;
        continue;
      }
      if (j != b + 1) {
        if (j == n) {
          e2[n - 1] = (e2[n - 1] + d[j]) % mod;
          continue;
        }
        d2[j] = (d2[j] - d[j]);
        if (d2[j] < 0) d2[j] += mod;
        if (j + (j - b - 1) <= n)
          e2[j + (j - b - 1)] = (e2[j + (j - b - 1)] + d[j]) % mod;
        else
          e2[n] = (e2[n] + d[j]) % mod;
      }
    }
    for (int j = n; j > b; j--) {
      d[j] = d2[j], e[j] = e2[j];
      d2[j] = e2[j] = 0;
    }
  }
  cout << ans;
  return 0;
}
