#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const int INF = 1e+9 + 1;
const long long int INFLL = 1e+18 + 1;
const long long int M = 1000000007LL;
const int N = 5005;
int n, k, a, b;
long long int dp[2][N], s[N];
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  dp[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) s[j] = (s[j - 1] + dp[0][j]) % M;
    for (int j = 1; j <= n; j++) {
      if (j < b) dp[1][j] = (s[(j + b - 1) / 2] - dp[0][j] + M) % M;
      if (j > b) dp[1][j] = (s[n] - s[(j + b) / 2] - dp[0][j] + M + M) % M;
    }
    for (int j = 1; j <= n; j++) {
      dp[0][j] = dp[1][j];
      dp[1][j] = 0;
    }
  }
  long long int r = 0;
  for (int i = 1; i <= n; i++) r = (r + dp[0][i]) % M;
  cout << r << "\n";
  return 0;
}
