#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (INT_MAX/3) #define PI (2*acos(0.0)) #define EPS (1e-8) typedef long long ll; typedef unsigned long long ull; int a[1000001]; int main(){ ios_base::sync_with_stdio(0); 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); return 0; }