#include <stdio.h>
#include <math.h>

int main(void) {
    double principal, rate, years, simple, compound_amount;
    int periods;
    if (scanf("%lf %lf %lf %d", &principal, &rate, &years, &periods) != 4 ||
        !isfinite(principal) || !isfinite(rate) || !isfinite(years) ||
        principal < 0 || principal > 1000000000.0 ||
        rate < 0 || rate > 100 || years < 0 || years > 100 ||
        periods < 1 || periods > 365) {
        puts("Invalid input.");
        return 1;
    }
    simple = principal * rate * years / 100.0;
    compound_amount = principal * pow(1.0 + rate / (100.0 * periods),
                                      periods * years);
    printf("Simple interest: %.2f\n", simple);
    printf("Simple amount: %.2f\n", principal + simple);
    printf("Compound interest: %.2f\n", compound_amount - principal);
    printf("Compound amount: %.2f\n", compound_amount);
    return 0;
}
