#include using namespace std; #define _p(...) (void)printf(__VA_ARGS__) #define forr(x,arr) for(auto&& x:arr) #define _overload3(_1,_2,_3,name,...) name #define _rep2(i,n) _rep3(i,0,n) #define _rep3(i,a,b) for(int i=int(a);i=int(a);i--) #define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__) #define ALL(x) (x).begin(), (x).end() #define BIT(n) (1LL<<(n)) #define SZ(x) ((int)(x).size()) #define fst first #define snd second using ll=long long;using pii=pair;using vb=vector; using vi=vector;using vvi=vector;using vvvi=vector; using vl=vector;using vvl=vector;using vvvl=vector; using vd=vector;using vvd=vector;using vvvd=vector; using vpii=vector;using vvpii=vector;using vvvpii=vector; using T = double; void Main() { int p0, q; cin >> p0 >> q; int N = 200; vector> dp(N+1, vector(101)); dp[0][p0] = 1./3; T w = 1./3, l = 1./3; rep(i, N) rep(pi, 101) { T p = pi /100.; T p2 = p/2; T p3 = (1-p)/3; T d = dp[i][pi]; w += d * p2 + d * p3; l += d * p3; dp[i+1][max(0, pi - q)] += d * p2; dp[i+1][min(100, pi + q)] += d * p3; } //rep(ii,SZ(dp)) { cout << "dp["<