import java.lang.*;
import java.io.*;
import java.util.Scanner;
class Main {
Scanner in
= new Scanner
(System.
in).
useDelimiter("[\\s+-]"); int[] dM = {31, 28, 31, 30 ,31, 30, 31, 31, 30, 31, 30, 31};
double s = in.nextDouble();
int p = in.nextInt();
int d = in.nextInt();
int day = in.nextInt();
char a;
int month = in.nextInt();
month--;
int dP = 0;
for(int i = month; dP < d; i++) {
double z = 0;
for(int j = (i==month?day : 1); j <= dM[i] && dP < d; j++) {
dP++;
z += s*(p/100.0)*(1/365.0);
}
s += z;
}
}
}
aW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2YS51dGlsLlNjYW5uZXI7CgpjbGFzcyBNYWluIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbiB7CiAgICAgICAgU2Nhbm5lciBpbiA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbikudXNlRGVsaW1pdGVyKCJbXFxzKy1dIik7CiAgICAgICAgaW50W10gZE0gPSB7MzEsIDI4LCAzMSwgMzAgLDMxLCAzMCwgMzEsIDMxLCAzMCwgMzEsIDMwLCAzMX07CiAgICAgICAgZG91YmxlIHMgPSBpbi5uZXh0RG91YmxlKCk7CiAgICAgICAgaW50IHAgPSBpbi5uZXh0SW50KCk7CiAgICAgICAgaW50IGQgPSBpbi5uZXh0SW50KCk7CiAgICAgICAgaW50IGRheSA9IGluLm5leHRJbnQoKTsKICAgICAgICBjaGFyIGE7CiAgICAgICAgaW50IG1vbnRoID0gaW4ubmV4dEludCgpOwogICAgICAgIG1vbnRoLS07CiAgICAgICAgaW50IGRQID0gMDsKICAgICAgICBmb3IoaW50IGkgPSBtb250aDsgZFAgPCBkOyBpKyspIHsKICAgICAgICAgICAgZG91YmxlIHogPSAwOwogICAgICAgICAgICBmb3IoaW50IGogPSAoaT09bW9udGg/ZGF5IDogMSk7IGogPD0gZE1baV0gJiYgZFAgPCBkOyBqKyspIHsKICAgICAgICAgICAgICAgIGRQKys7CiAgICAgICAgICAgICAgICB6ICs9IHMqKHAvMTAwLjApKigxLzM2NS4wKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzICs9IHo7CiAgICAgICAgfQogICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCIlLjZmIiwgcyk7CiAgICB9Cn0=