#include <cstdio>
#include <cmath>
float credit(float a, float b, float c, float x) {
float n = ceil(-log(((a - 1) * x) / (b - c) + 1) / log(a));
return c * n + (pow(a, n) * ((a - 1) * x + b - c) - b + c) / (a - 1);
}
int main() {
float a, b, c, x;
scanf("%f %f %f %f", &a, &b, &c, &x);
printf("%.2f", credit(a, b, c, x));
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNtYXRoPgoKZmxvYXQgY3JlZGl0KGZsb2F0IGEsIGZsb2F0IGIsIGZsb2F0IGMsIGZsb2F0IHgpIHsKICAgIGZsb2F0IG4gPSBjZWlsKC1sb2coKChhIC0gMSkgKiB4KSAvIChiIC0gYykgKyAxKSAvIGxvZyhhKSk7CiAgICByZXR1cm4gYyAqIG4gKyAocG93KGEsIG4pICogKChhIC0gMSkgKiB4ICsgYiAtIGMpIC0gYiArIGMpIC8gKGEgLSAxKTsKfQoKaW50IG1haW4oKSB7CiAgICBmbG9hdCBhLCBiLCBjLCB4OwogICAgc2NhbmYoIiVmICVmICVmICVmIiwgJmEsICZiLCAmYywgJngpOwogICAgcHJpbnRmKCIlLjJmIiwgY3JlZGl0KGEsIGIsIGMsIHgpKTsKICAgIHJldHVybiAwOwp9