/+ dub.sdl:
    name "E"
    dependency "dunkelheit" version="1.0.1"
+/

import std.stdio, std.algorithm, std.range, std.conv;
// import dkh.foundation, dkh.scanner;

/*
int l;
long mod;

long calc(int n, int a, int b, int c, int d) {
    assert(c >= 0 && d >= 0);
    assert(c == 0 || d == 0);
    if (n == 0) return 1;
    long ans = 0;
    // off
    {
        int nc = d;
        if (a && b >= l + 1) {            
            assert(a >= 1 && l - a >= 1);
            nc = (nc == 0) ? l - a : min(nc, l - a);
        }
        ans = (ans + calc(n - 1, b, 0, nc, 0)) % mod;
    }

    // on
    if (c != 1 && (a < l || b < l)) {
        ans = (ans + calc(n - 1, b, a + 1, d, max(0, c - 1))) % mod;
    }

    return ans;
}*/

int main() {
    Scanner sc = new Scanner(stdin);
    scope(exit) assert(!sc.hasNext);

    int n, k;
    long mod;
    sc.read(n, k, mod);
    int l = k / 2 + 1;

    if (k % 2 == 0) {
        long[] dp = new long[n / 2 + 5];
        dp[0] = 1;
        foreach (i; 1 .. n / 2 + 5) {
            foreach (j; max(0, i - l) .. i) {
                dp[i] += dp[j];
                dp[i] %= mod;
            }
        }
        writeln(dp[n / 2 + 1] * dp[(n + 1) / 2 + 1] % mod);
        return 0;
    }

    //writeln(calc(n, 0, 0, 0, 0));


    //long[][][][] dp = new long[][][][](n / 2 + 2, n / 2 + 2, l + 1, l + 1);    
    //dp[0][0][0][0] = 1;

    int to_i(int a, int b, int c, int d) {
        return a * 80 * 80 * 80 + b * 80 * 80 + c * 80 + d;
    }

    long[] dp = new long[80 * 80 * 80 * 80];
    dp[0] = 1;
    long[] ndp = new long[80 * 80 * 80 * 80];
    foreach (_n; 0..n) {
        //long[][][][] ndp = new long[][][][](n / 2 + 2, n / 2 + 2, l + 1, l + 1);        
        foreach (a; 0..n/2 + 2) {
            foreach (b; 0..n/2 + 2) {
                foreach (c; 0..l + 1) {
                    ndp[to_i(a, b, c, 0)] = 0;
                }
                foreach (d; 1..l + 1) {
                    ndp[to_i(a, b, 0, d)] = 0;
                }
            }
        }
        void calc(int a, int b, int c, int d) {
            if (dp[to_i(a, b, c, d)] == 0) return;
            // off
            {
                int nc = d;
                if (a && b >= l + 1) {            
                    assert(a >= 1 && l - a >= 1);
                    nc = (nc == 0) ? l - a : min(nc, l - a);
                }
                ndp[to_i(b, 0, nc, 0)] += dp[to_i(a, b, c, d)];
                ndp[to_i(b, 0, nc, 0)] %= mod;
            }

            // on
            if (c != 1 && (a < l || b < l)) {
                ndp[to_i(b, a+1, d, max(0, c - 1))] += dp[to_i(a, b, c, d)];
                ndp[to_i(b, a+1, d, max(0, c - 1))] %= mod;
            }
        }
        foreach (a; 0..n/2 + 2) {
            foreach (b; 0..n/2 + 2) {
                foreach (c; 0..l + 1) {
                    calc(a, b, c, 0);
                }
                foreach (d; 1..l + 1) {
                    calc(a, b, 0, d);
                }
            }
        }
        swap(dp, ndp);
        //dp = ndp;
    }

    writeln(dp.sum % mod);
//    writeln(dp.map!(v => v.map!(v => v.map!(v => v.sum % mod).sum % mod).sum % mod).sum % mod);
    return 0;
}
/* IMPORT /home/yosupo/Programs/dunkelheit/source/dkh/foundation.d */
 
// module dkh.foundation;

 
static if (__VERSION__ <= 2070) {
    /*
    Copied by https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d
    Copyright: Andrei Alexandrescu 2008-.
    License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
    */
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            import std.algorithm : reduce;
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                import std.typecons : tuple;
                return reduce!fun(tuple(seed), r);
            }
        }
    }
     
}
/* IMPORT /home/yosupo/Programs/dunkelheit/source/dkh/container/stackpayload.d */
// module dkh.container.stackpayload;

 
struct StackPayload(T, size_t MINCAP = 4) if (MINCAP >= 1) {
    import core.exception : RangeError;

    private T* _data;
    private uint len, cap;

    @property bool empty() const { return len == 0; }
    @property size_t length() const { return len; }
    alias opDollar = length;

     
    inout(T)[] data() inout { return (_data) ? _data[0..len] : null; }
    
    ref inout(T) opIndex(size_t i) inout {
        version(assert) if (len <= i) throw new RangeError();
        return _data[i];
    }  
    ref inout(T) front() inout { return this[0]; }  
    ref inout(T) back() inout { return this[$-1]; }  

    void reserve(size_t newCap) {
        import core.memory : GC;
        import core.stdc.string : memcpy;
        import std.conv : to;
        if (newCap <= cap) return;
        void* newData = GC.malloc(newCap * T.sizeof);
        cap = newCap.to!uint;
        if (len) memcpy(newData, _data, len * T.sizeof);
        _data = cast(T*)(newData);
    }  
    void free() {
        import core.memory : GC;
        GC.free(_data);
    }  
     
    void clear() {
        len = 0;
    }

    void insertBack(T item) {
        import std.algorithm : max;
        if (len == cap) reserve(max(cap * 2, MINCAP));
        _data[len++] = item;
    }  
    alias opOpAssign(string op : "~") = insertBack;  
    void removeBack() {
        assert(!empty, "StackPayload.removeBack: Stack is empty");
        len--;
    }  
}

 
/* IMPORT /home/yosupo/Programs/dunkelheit/source/dkh/scanner.d */
// module dkh.scanner;

// import dkh.container.stackpayload;

 
class Scanner {
    import std.stdio : File;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeChar, isStaticArray, isArray; 
    import std.algorithm : map;
    private File f;
     
    this(File f) {
        this.f = f;
    }
    private char[512] lineBuf;
    private char[] line;
    private bool succW() {
        import std.range.primitives : empty, front, popFront;
        import std.ascii : isWhite;
        while (!line.empty && line.front.isWhite) {
            line.popFront;
        }
        return !line.empty;
    }
    private bool succ() {
        import std.range.primitives : empty, front, popFront;
        import std.ascii : isWhite;
        while (true) {
            while (!line.empty && line.front.isWhite) {
                line.popFront;
            }
            if (!line.empty) break;
            line = lineBuf[];
            f.readln(line);
            if (!line.length) return false;
        }
        return true;
    }

    private bool readSingle(T)(ref T x) {
        import std.algorithm : findSplitBefore;
        import std.string : strip;
        import std.conv : parse;
        if (!succ()) return false;
        static if (isArray!T) {
            alias E = ElementType!T;
            static if (isSomeChar!E) {
                 
                 
                auto r = line.findSplitBefore(" ");
                x = r[0].strip.dup;
                line = r[1];
            } else static if (isStaticArray!T) {
                foreach (i; 0..T.length) {
                    assert(succW());
                    x[i] = line.parse!E;
                }
            } else {
                StackPayload!E buf;
                while (succW()) {
                    buf ~= line.parse!E;
                }
                x = buf.data;
            }
        } else {
            x = line.parse!T;
        }
        return true;
    }

     
    int unsafeRead(T, Args...)(ref T x, auto ref Args args) {
        if (!readSingle(x)) return 0;
        static if (args.length == 0) {
            return 1;
        } else {
            return 1 + read(args);
        }
    }
     
    void read(Args...)(auto ref Args args) {
        import std.exception : enforce;
        static if (args.length != 0) {
            enforce(readSingle(args[0]));
            read(args[1..$]);
        }
    }
     
    bool hasNext() {
        return succ();
    }
}


 
 

 

/*
This source code generated by dunkelheit and include dunkelheit's source code.
dunkelheit's Copyright: Copyright (c) 2016- Kohei Morita. (https://github.com/yosupo06/dunkelheit)
dunkelheit's License: MIT License(https://github.com/yosupo06/dunkelheit/blob/master/LICENSE.txt)
*/


Measured memory_bytes: 644348