import java.util.Scanner;
/**
* @author Oxygen
* @date 2018年8月31日
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int K = scanner.nextInt();
int A =scanner.nextInt();
int X = scanner.nextInt();
int B = scanner.nextInt();
int Y = scanner.nextInt();
int[] p = new int[X + Y];
int[][] dp = new int[X+Y+1][K+1];
for (int i = 0; i < X + Y; i++) {
if (i < X) {
p[i] = A;
} else {
p[i] = B;
}
}
for (int i = 0; i < X+Y+1; i++) { //
dp[i][0] =1;
}
for (int i = 1; i < X+Y+1; i++) { // i为前i首歌曲,j表示组成歌单长度
for (int j = 1; j < K+1; j++) {
if (j>=p[i-1]) {
dp[i][j] = (dp[i-1][j]+dp[i-1][j-p[i-1]])%1000000007;
}else {
dp[i][j] = dp[i-1][j]%1000000007;
}
}
}
System.out.println(dp[X+Y][K]);
}
}