#include <bits/stdc++.h>
#pragma gcc optimize("O3")
#define endl '\n'
using namespace std;

const int MAXN = 1e6;
const long long mod = 998244353;
int dp[MAXN];

set <vector <int>> s;
set <vector <int>> visited;

    int n, m, k;
vector <int> v;

void rec(int ind = 0)
{
    if (ind == n) return;

    if (visited.count(v) > 1) return;
    visited.insert(v);

    bool unfinished = false;

    for (int i = 0; i < n; i++) {
        if (!v[i]) {
            unfinished = true;
            break;
        }
    }

    if (!unfinished)
    {
        s.insert(v);

//        for (int i = 0; i < n; i++)
//            cerr << v[i] << " ";
//        cerr << endl;

    }

    vector <int> p = v;

    for (int i = 0; i < n - k + 1; i++)
    {
        for (int c = 1; c <= m; c++)
        {
            for (int j = i; j < i + k; j++)
            {
                v[j] = c;
            }
            rec(ind + 1);
        }
        v = p;
        rec(ind + 1);
    }

}

int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m >> k;

    v.resize(n);
    rec();

    cout << s.size() << endl;

    return 0;
}
/***

3 2 2


6

*/

