#!/usr/bin/env python3 (c, t, r), p = map(int, input().split()), float(input()) time_to_type, dp = [0] * (c + 1), [0] * (c + 1) # time_to_type[x] is the expected time to type x characters without saving at any time. # Derived from: time_to_type[x] = dp[0][x] + 1-p + p * (1 + r + time_to_type[x]) for i in range(1, c + 1): time_to_type[i] = (time_to_type[i - 1] + 1 + p * r) / (1 - p) # dp[y] is the time required to type all characters between indices 0 (inclusive) and y (exclusive). for l in range(1, c + 1): dp[l] = min(time_to_type[l], *(dp[k] + t + time_to_type[l - k] for k in range(l))) #print(time_to_type) print(dp[c] + t)