#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repd(i,0,n) #define all(x) (x).begin(),(x).end() #define mod 1000000007 #define inf 2000000007 #define mp make_pair #define pb push_back typedef long long ll; using namespace std; template inline void output(T a, int p = 0) { if(p) cout << fixed << setprecision(p) << a << "\n"; else cout << a << "\n"; } // end of template int p, q; double f(int cur = p, int depth = 0){ if(depth >= 20) return 1.0; double win = double(p) / 200.0 + double(100 - p) / 300.0; double draw_y = double(p) * f(max(0, p - q), depth + 1) / 200.0; double draw_n = double(100 - p) * f(min(100, p + q), depth + 1) / 300.0; return win + draw_y + draw_n; } int main() { cin.tie(0); ios::sync_with_stdio(0); // source code cin >> p >> q; double ret = 1.0 / 3.0 + 1.0 / 3.0 * f(); output(ret, 10); return 0; }