1. #include <cstdio>
    2. #include <algorithm>
    3. #include <cstdlib>
    4. #include <cstring>
    5. #include <iostream>
    6. using namespace std;
    7. inline int gi(){
    8. char tmp=getchar();int ans=0;
    9. while(!isdigit(tmp)) tmp=getchar();
    10. while(isdigit(tmp)){
    11. ans = ans * 10 + tmp - '0';
    12. tmp = getchar();
    13. }
    14. return ans;
    15. }
    16. const int N = 1500;
    17. double F[N][N];
    18. double Dfs(int a,int b){
    19. if(a<0 || b<0) return 0.0;
    20. if(!a && !b) return 0.0;
    21. if(!a) return 1.0;
    22. if(!b) return 0.0;
    23. if(F[a][b]) return F[a][b];
    24. int i=a,j=b;
    25. double c1 = 1.0 * j / (1.0 * i + j);
    26. double c3=0,c4=0;
    27. if(i+j == 2)
    28. return F[a][b]=c1; // black or white
    29. c3 = 1.0*i/(i+j) * (i-1)/(i+j-1) * (i-2)/(i+j-2) * Dfs(i-3,j);
    30. c4 = 1.0 * i/(i+j) * (i-1)/(i+j-1) * j/(i+j-2) * Dfs(i-2,j-1);
    31. return F[a][b] = double(c1 + c3 + c4);
    32. }
    33. signed main()
    34. {
    35. int a,b;
    36. a=gi(),b=gi();
    37. printf("%.9lf",Dfs(b,a));
    38. return 0;
    39. }