#include using namespace std; vector count_divisor(int n) { vector c(n + 1); for (int i = 1; i <= n; ++i) { for (int j = i; j <= n; j += i) ++c[j]; } return c; } int main() { int n; double p, res = 0; cin >> n >> p; auto c = count_divisor(n); for (int i = 2; i <= n; ++i) res += pow(1 - p, c[i] - 2); cout << fixed << setprecision(15) << res << endl; }