using System; class Program { static void Main(string[] args) { //入力 string s = Console.ReadLine(); string[] t = s.Split(' '); int N = int.Parse(t[0]); double p = double.Parse(t[1]); //回答となる素数の個数の期待値 double ans = 0; //指数の和 int exp; //2からチェックしていく for (int i = 2; i <= N; i++) { exp = 0; int kari = i; int j = 2; while (true) { if (kari % j == 0) { exp++; kari /= j; } else if (kari < j) { break; } else { j++; } } if (exp >= 2) { ans += Math.Pow(1 - p, exp); } else if (p == 1) { if (exp == 1) { ans++; } } else { ans += Math.Pow(1 - p, exp); } } //出力 Console.WriteLine(ans); } }