#include #include #include #include using namespace std; using ld = long double; int main() { int n; ld p; cin >> n >> p; vector count(n + 1); for (int i = 2; i <= n; i++) { for (int j = i * 2; j <= n; j += i)count[j]++; } vector v(200, 1); for (int i = 1; i < 200; i++)v[i] = v[i - 1] * (1 - p); ld ret = 1; for (int i = 3; i <= n; i++) ret += v[count[i]]; cout << fixed << setprecision(15) << ret << endl; return 0; }