//#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;
typedef double ld;
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define prev _prev
#define y0 _y0
#define kill _kill

//permanent constants
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int digarr[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int alf = 26;
const int dig = 10;
const int two = 2;
const int th = 3;
const ll prost = 239;
const ll btc = 30;
const ld eps = 1e-8;
const ll INF = (ll)(1e18 + 239);
const int BIG = (int)(1e9 + 239);
const int MOD = 1e9 + 7;

//random
#ifdef ONPC
mt19937_64 rnd(239);
#else
mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

//constants
const int M = (int)(2e5 + 239);
const int N = (int)(2e3 + 239);
const int L = 19;
const int T = (1 << 18) + 239;
const int B = 500;
const int X = 5010;

int n, a, b;

bool ok_a(string s)
{
    bool has = false;
    for (int i = 0; i < s.size(); i++)
        has |= (s[i] == '0');
    if (!has)
        return false;
    int cur = -1;
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] - '0' == cur)
        {
            cnt++;
            continue;
        }
        if (cur == 0)
        {
            if (cnt < a)
                return false;
        }
        cur = s[i] - '0';
        cnt = 1;
    }
    if (cur == 0)
    {
        if (cnt < a)
            return false;
    }
    return true;
}

bool ok_b(string s)
{
    bool has = false;
    for (int i = 0; i < s.size(); i++)
        has |= (s[i] == '1');
    if (!has)
        return false;
    int cur = -1;
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] - '0' == cur)
        {
            cnt++;
            continue;
        }
        if (cur == 1)
        {
            if (cnt < b)
                return false;
        }
        cur = s[i] - '0';
        cnt = 1;
    }
    if (cur == 1)
    {
        if (cnt < b)
            return false;
    }
    return true;
}

bool check(string s)
{
    for (int i = 0; i < n; i++)
        for (int j = i; j < n; j++)
            if (j - i + 1 >= a)
                if (ok_b(s.substr(i, j - i + 1)))
                    return true;
    for (int i = 0; i < n; i++)
        for (int j = i; j < n; j++)
            if (j - i + 1 >= b)
                if (ok_a(s.substr(i, j - i + 1)))
                    return true;
    return false;
}

void slow()
{
    int ans = 0;
    for (int mask = 0; mask < (1 << n); mask++)
    {
        string s = "";
        for (int i = 0; i < n; i++)
            s += (char)('0' + ((mask >> i) & 1));
        if (check(s))
        {
            ans++;
            //cerr << s << "\n";
        }
    }
    cout << "correct: " << ans << "\n";
}

int help[X], dp[two][X];

int32_t main()
{
#ifdef ONPC
    freopen("input", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> a >> b;
    if (a < b)
        swap(a, b);
    help[0] = 1;
    for (int i = 1; i < a; i++)
    {
        help[i] = help[i - 1];
        if (i >= b)
        {
            help[i]++;
            if (help[i] >= MOD)
                help[i] -= MOD;
        }
        for (int j = b; j + 1 <= i; j++)
        {
            help[i] += help[i - 1 - j];
            if (help[i] >= MOD)
                help[i] -= MOD;
        }
    }
    dp[0][0] = 1;
    dp[1][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        dp[0][i] = 0;
        for (int j = 1; j <= min(i, a - 1); j++)
        {
            int now = 0;
            if (i == j)
            {
                if (i == n)
                    now = help[j];
                else
                    now = help[j - 1];
            }
            else
            {
                if (i == n)
                    now = help[j - 1];
                else
                {
                    if (j == 1)
                        now = 1;
                    else
                        now = help[j - 2];
                }
            }
            dp[0][i] += 1LL * dp[1][i - j] * now % MOD;
            if (dp[0][i] >= MOD)
                dp[0][i] -= MOD;
        }
        dp[1][i] = 0;
        for (int j = 1; j <= min(i, b - 1); j++)
        {
            dp[1][i] += dp[0][i - j];
            if (dp[1][i] >= MOD)
                dp[1][i] -= MOD;
        }
    }
    int bad = dp[0][n] + dp[1][n];
    if (bad >= MOD)
        bad -= MOD;
    int all = 1;
    for (int i = 0; i < n; i++)
    {
        all += all;
        if (all >= MOD)
            all -= MOD;
    }
    all -= bad;
    if (all < 0)
        all += MOD;
    cout << all << "\n";
#ifdef ONPC
    if (n <= 10)
        slow();
#endif
    return 0;
}

Measured memory_bytes: 3712