#include #include #include #include #include using namespace std; typedef long long LL; int main(){ int v1[] = {2,3,5,7,11,13}; int v2[] = {4,6,8,9,10,12}; int P, C; cin >> P >> C; map prev; map next; prev[1] = 1; for(int i = 0; i < P; i++){ for(int j = 0; j < 6; j++){ for(auto& p : prev){ next[p.first * v1[j]] += p.second; } } prev.swap(next); next.clear(); } for(int i = 0; i < C; i++){ for(int j = 0; j < 6; j++){ for(auto& p : prev){ next[p.first * v2[j]] += p.second; } } prev.swap(next); next.clear(); } LL total = 0; for(auto& p : prev){ total += p.second; } double exp = 0.0; for(auto& p : prev){ exp += p.first * (double)(p.second) / total; } cout << setprecision(13) << exp << endl; return 0; }