p456.ans1
======================
90.00000

=================
p456.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int64_t s, m, p;

void read() {
    cin >> s >> m >> p;
}

void solve() {
    // Annuity payment: each month the same x is paid, of which p% of the
    // current debt is interest and the rest reduces the principal, so the debt
    // must reach 0 after m months. With monthly rate r = p/100 the standard
    // annuity formula gives x = s * r * (1+r)^m / ((1+r)^m - 1). When p = 0
    // there is no interest and the payment is simply s / m.

    double x;
    if(p == 0) {
        x = (double)s / m;
    } else {
        double r = p / 100.0;
        double pw = pow(1 + r, (double)m);
        x = s * (r * pw) / (pw - 1);
    }

    cout << fixed << setprecision(5) << x << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p456.in1
======================
100 2 50

=================
p456.py
======================
def find_monthly_payment(s, m, p):
    if p == 0:
        return s / m

    r = p / 100
    numerator = r * pow(1 + r, m)
    denominator = pow(1 + r, m) - 1
    x = s * numerator / denominator
    return x


def main():
    s, m, p = map(int, input().split())
    x = find_monthly_payment(s, m, p)
    print(f"{x:.5f}")


if __name__ == "__main__":
    main()

=================
statement.txt
======================
456. Annuity Payment Scheme
Time limit per test: 0.5 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



At the peak of the Global Economic Crisis BerBank offered an unprecedented credit program. The offering was so attractive that Vitaly decided to try it. He took a loan of s burles for m months with the interest rate of p percent.

Vitaly has to follow the scheme of annuity payments, meaning that he should make fixed monthly payments — x burles per month. Obviously, at the end of the period he will pay m · x burles to the bank in total.

Each of the monthly payments is divided by BerBank into two parts as follows:
The first part ai is used to pay off the percent p of the current debt. It's clear that ai=s' · p / 100 where s'=s for the first month and equals to the remaining debt for each of the subsequent months.
The second part bi is used to pay off the current debt. The sum of all bi over the payment period is equal to s, meaning that the borrower needs to pay off the debt completely by decreasing it from s to 0 in m months.
BerBank uses calculations with floating-point numbers, and the value of x is uniquely determined by s,m and p.

For example, if s=100, m=2, p=50 then x=90. For the first month a1 = s' · p / 100 = s · p / 100 = 50 and b1 = 90 - 50 = 40. For the second month a2 = (100-40) · 50 / 100 = 30, so b2 = 90 - 30 = 60 and the debt is paid off completely.

Your task is to help Vitaly and write a program that computes x given the values of s,m and p.

Input
The single line of the input contains three integers s, m and p (1 ≤ s ≤ 106, 1 ≤ m ≤ 120, 0 ≤ p ≤ 100).

Output
Output the single value of monthly payment x in burles. An absolute error of up to 10-5 is allowed.

Example(s)
sample input
sample output
100 2 50
90.00000

=================
