#include #define rep(x, to) for (int x = 0; x < (to); x++) #define REP(x, a, to) for (int x = (a); x < (to); x++) #define EPS (1e-14) #define _PA(x,N) rep(i,N){cout< PII; typedef pair PLL; typedef complex Complex; typedef vector< vector > Mat; int p, q; char done[105][10005]; double dp[105][10005]; double dfs(int r, int depth) { if (depth < 0) { return 0; } if (done[r][depth]) { return dp[r][depth]; } double a, b; double pp = r / 100.0; // use a = pp / 2.0 + pp / 2 * dfs(max(0, r - q), depth - 1); // not use b = (1.0 - pp) / 3.0 + (1.0 - pp) / 3.0 * dfs(min(100, r + q), depth - 1); done[r][depth] = 1; return dp[r][depth] = a + b; } void solve() { printf("%.12f\n", 1.0 / 3.0 + 1.0 / 3.0 * dfs(p, 10000)); } int main() { cin >> p >> q; solve(); return 0; }