#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
const int moder = 1000000007;
int n, a, b, k;
int ans;
void dfs(int na, int step){
if(step == k+1){
ans %= moder;
ans++;
return;
}
int delta = abs(na - b) - 1;
if(delta == 0) return;
int l = na - delta;
int r = na + delta;
if(l < 1) l = 1;
if(r > n) r = n;
for(int i = l; i <= r; i++)
if(i != na) dfs(i, step+1);
}
int main(){
freopen("lift.in", "r", stdin);
freopen("lift.out", "w", stdout);
scanf("%d%d%d%d", &n, &a, &b, &k);
if(abs(a-b) == 1){
printf("0\n");
return 0;
}
dfs(a, 1);
printf("%d\n", ans);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int moder = 1e9 + 7;
int n, a, b, k;
long long sum[5010], start, end;
int dp[5012][2];
inline int read(){
int num = 0;
char c;
while((c = getchar()) == ' ' || c == '\r' || c == '\n');
num = c - '0';
while(isdigit(c = getchar())) num = num*10 + c - '0';
return num;
}
int main(){
n = read(); a = read();
b = read(); k = read();
if(abs(a-b) == 1){
printf("0\n");
return 0;
}
int now = 1, pre = 0;
for(int i = 1; i <= n; i++)
dp[i][pre] = 1;
for(int i = k; i <= 1; i++){
sum[0] = 0;
for(int j = 1; j <= n; j++)
sum[j] = dp[j][pre] + sum[j-1];
for(int j = 1; j <= n; j++)
if(j != b){
int delta = abs(j - b);
if(j - delta < 0)
start=0;
else
start = j - delta;
start++;
if(j + delta > 1 + n)
end = n + 1;
else
end = j + delta;
end--;
dp[j][now] = (sum[end] - sum[start-1] - dp[j][pre]) % moder;
}
swap(now, pre);
}
printf("%d\n", dp[a][pre]);
return 0;
}