#include using namespace std; // a[k] := 1 と k 自身を除く k の約数の個数 int a[1000001]; int main() { int N; double p; cin >> N >> p; for (int i = 2; i <= N; i++) for (int j = i * 2; j <= N; j += i) a[j]++; double e = 0; for (int i = 2; i <= N; i++) if (a[i] == 0) e += 1; else e += pow(1 - p, a[i]); printf("%.10f\n", e); }