#include <cassert>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

namespace detail {

bool is_zero(double d) {
    return (std::abs(d) < 1e-9);
}
bool is_zero(long double d) {
    return (std::abs(d) < 1e-9);
}

}

template <typename T>
class matrix {
public:
    matrix(int r, int c) 
        : v_(r, std::vector<T>(c)),
          row_(r),
          column_(c)
    {}
    matrix(std::vector<std::vector<T>> const& v)
        : v_(v),
          row_(v.size()),
          column_((v.size() == 0 ? 0 : v[0].size()))
    {}
    matrix(matrix const&) = default;
    matrix(matrix&&) = default;
    matrix& operator=(matrix const&) = default;
    matrix& operator=(matrix&&) = default;
    ~matrix() = default;

    std::vector<T>& operator[](unsigned int i) {
        return v_[i];
    }
    const std::vector<T>& operator[](unsigned int i) const {
        return v_[i];
    }
    matrix& operator+=(matrix const& other) {
        assert("matrix operator+: row or column size does not match" && other.row_size() == row_ && other.column_size() == column_);

        for(int i=0; i<row_; ++i) {
            for(int j=0; j<column_; ++j) {
                v_[i][j] += other[i][j];
            }
        }
        return *this;
    }
    matrix& operator-=(matrix const& other) {
        assert("matrix operator-: row or column size does not match" && other.row_size() == row_ && other.column_size() == column_);

        for(int i=0; i<row_; ++i) {
            for(int j=0; j<column_; ++j) {
                v_[i][j] -= other[i][j];
            }
        }
        return *this;
    }

    bool operator==(matrix const& rhs) const {
        if(row_ != rhs.row_size() || column_ != rhs.column_size()) {
            return false;
        }
        for(int i=0; i<row_; ++i) {
            for(int j=0; j<column_; ++j) {
                if(std::abs(v_[i][j] - rhs[i][j]) > 1e-9) {
                    return false;
                }
            }
        }
        return true;
    }
    bool operator!=(matrix const& rhs) {
        return !(*this == rhs);
    }

    int row_size() const {
        return row_;
    }
    int column_size() const {
        return column_;
    }

    // for debug
    void print() {
        for(int i=0; i<row_; ++i) {
            for(int j=0; j<column_; ++j) {
                std::cout << v_[i][j];
                if(j != column_ - 1) {
                    std::cout << " ";
                }
            }
            std::cout << std::endl;
        }
    }

private:
    std::vector<std::vector<T>> v_;
    int row_, column_;
};

template <typename T>
matrix<T> operator-(matrix<T> m) {
    for(int i=0; i<m.row_size(); ++i) {
        for(int j=0; j<m.column_size(); ++j) {
            m[i][j] = -m[i][j];
        }
    }
}

template <typename T>
matrix<T> operator+(matrix<T> lhs, matrix<T> const& rhs) {
    lhs += rhs;
    return lhs;
}

template <typename T>
matrix<T> operator-(matrix<T> lhs, matrix<T> const& rhs) {
    lhs -= rhs;
    return lhs;
}

template <typename T>
matrix <T> operator*(matrix<T> const& lhs, matrix<T> const& rhs) {
    assert("matrix operator*: lhs.column_size() != rhs.row_size()" && lhs.column_size() == rhs.row_size());

    matrix<T> ret(lhs.row_size(), rhs.column_size());
    for(int i=0; i<ret.row_size(); ++i) {
        for(int k=0; k<lhs.column_size(); ++k) {
            for(int j=0; j<ret.column_size(); ++j) {
                ret[i][j] += lhs[i][k] * rhs[k][j];
            }
        }
    }
    return ret;
}

template <typename T>
matrix<T> eye(int n) {
    matrix<T> res(n, n);
    for(int i=0; i<n; ++i) {
        res[i][i] = 1;
    }
    return res;
}

template <typename T>
matrix<T> pow(matrix<T> x, long long y) {
    assert("matrix pow: matrix is not square" && x.column_size() == x.row_size());
    matrix<T> ret = eye<T>(x.column_size());
    while(y > 0) {
        if(y & 1) {
            ret = ret * x;
        }
        x = x * x;
        y >>= 1;
    }
    return ret;
}

vector<double> gauss_jordan(matrix<double>& A, std::vector<double> const& b) {
    int n = A.row_size();
    matrix<double> B(n, n+1);
    for(int i=0; i<n; ++i) {
        for(int j=0; j<n; ++j) {
            B[i][j] = A[i][j];
        }
    }
    for(int i=0; i<n; ++i) {
        B[i][n] = b[i];
    }

    for(int i=0; i<n; ++i) {
        int pivot = i;
        for(int j=i; j<n; ++j) {
            if(std::abs(B[j][i]) > std::abs(B[pivot][i])) {
                pivot = j;
            }
        }
        std::swap(B[i], B[pivot]);
        if(std::abs(B[i][i]) < 1e-9) {
            return std::vector<double>();
        }

        for(int j=i+1; j<=n; ++j) {
            B[i][j] /= B[i][i];
        }
        for(int j=0; j<n; ++j) {
            if(i != j) {
                for(int k=i+1; k<=n; ++k) {
                    B[j][k] -= B[j][i] * B[i][k];
                }
            }
        }
    }

    std::vector<double> x(n);
    for(int i=0; i<n; ++i) {
        x[i] = B[i][n];
    }
    return x;
}


int main() {
    int S, N, K;
    cin >> S >> N >> K;
    S = abs(S);
    cout << fixed << setprecision(10);
    if(N == 1) {
        if(S % K == 0) {
            cout << S / K << endl;
        } else {
            cout << -1 << endl;
        }
        return 0;
    }
    vector<vector<double>> p(K+1, vector<double>(N*K+1, 0));
    p[0][0] = 1.0;
    for(int i=0; i<K; ++i) {
        for(int j=0; j<=N*K; ++j) {
            for(int k=1; k<=N; ++k) {
                if(j + k > N*K) continue;
                p[i+1][j+k] += p[i][j] / N;
            }
        }
    }
    vector<double> sp = p[K];

    matrix<double> m(N*K+1, N*K+1);
    m[0][0] = -1;
    for(int i=1; i<N*K+1; ++i) {
        m[i][i] = -1;
        for(int j=0; j<N*K+1; ++j) {
            if(j <= i) {
                m[i][j] += sp[i-j];
            }
            if(j+i < N*K+1 && j != 0) {
                m[i][j] += sp[i+j];
            }
        }
    }
    vector<double> b(N*K+1, -1);
    b[0] = 0;
    auto res1 = gauss_jordan(m, b);

    if(S <= N*K) {
        cout << res1[S] << endl;
    } else {
        matrix<double> d(N*K+1, 1);
        for(int i=0; i<N*K; ++i) {
            d[i][0] = res1[N*K-i-1];
        }
        d[N*K][0] = 1;
        matrix<double> C(N*K+1, N*K+1);
        for(int i=0; i<N*K-1; ++i) {
            C[i+1][i] = 1;
        }
        C[0][N*K] = 1;
        C[N*K][N*K] = 1;
        for(int i=0; i<N*K; ++i) {
            C[0][i] = sp[i+1];
        }
        //C.print();
        C = pow(C, S-N*K+1);
        auto res = C * d;
        cout << res[0][0] << endl;
    }
}


Measured memory_bytes: 3444