import java.io.*; import java.util.*; public class Maarten { public static void main(String[] args) throws IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { new Maarten().run(new Scanner(reader)); } } public void run(Scanner sc) throws IOException { int c = sc.nextInt(); long t = sc.nextLong(), r = sc.nextLong(); double p = sc.nextDouble(); double[] time_to_type = new double[c + 1], dp = new double[c + 1]; for (int i = 1; i <= c; i++) { time_to_type[i] = (time_to_type[i - 1] + 1 + p * r) / (1 - p); } for (int l = 1; l <= c; l++) { dp[l] = time_to_type[l]; for (int k = 0; k < l; k++) { dp[l] = Math.min(dp[l], dp[k] + t + time_to_type[l - k]); } } System.out.println(dp[c] + t); } }