Problem:
Score : 700 points

Problem Statement

Today, Snuke will eat B pieces of black chocolate and W pieces of white chocolate for an afternoon snack.

He will repeat the following procedure until there is no piece left:

Choose black or white with equal probability, and eat a piece of that color if it exists.

For each integer i from 1 to B+W (inclusive), find the probability that the color of the i-th piece to be eaten is black.
It can be shown that these probabilities are rational, and we ask you to print them modulo 10^9 + 7, as described in Notes.

Notes

When you print a rational number, first write it as a fraction \frac{y}{x}, where x, y are integers and x is not divisible by 10^9 + 7
(under the constraints of the problem, such representation is always possible).
Then, you need to print the only integer z between 0 and 10^9 + 6, inclusive, that satisfies xz \equiv y \pmod{10^9 + 7}.

Constraints

All values in input are integers.

1 \leq B,W \leq 10^{5}

Input

Input is given from Standard Input in the following format:

B W

Output

Print the answers in B+W lines. In the i-th line, print the probability that the color of the i-th piece to be eaten is black, modulo 10^{9}+7.

Sample Input 1

2 1

Sample Output 1

500000004
750000006
750000006

There are three possible orders in which Snuke eats the pieces:

white, black, black

black, white, black

black, black, white

with probabilities \frac{1}{2}, \frac{1}{4}, \frac{1}{4}, respectively. Thus, the probabilities of eating a black piece first, second and third are \frac{1}{2},\frac{3}{4} and \frac{3}{4}, respectively.

Sample Input 2

3 2

Sample Output 2

500000004
500000004
625000005
187500002
187500002

They are \frac{1}{2},\frac{1}{2},\frac{5}{8},\frac{11}{16} and \frac{11}{16}, respectively.

Sample Input 3

6 9

Sample Output 3

500000004
500000004
500000004
500000004
500000004
500000004
929687507
218750002
224609377
303710940
633300786
694091802
172485353
411682132
411682132

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
using namespace std;
struct P
{
    int x,y,z;
    bool operator<(const P &a)const{
        //if(y!=a.y) return y>a.y;
        return max(x,-x)>max(a.x,-a.x);

    }

};
vector<P> v;
//bitset<4001000> b;
int i,n,d,m,k,a,b,c,e;
long long o[211111];
long long l[222221];
long long j[211111];

int dx[10]={0,1,0,-1,1,1,-1,-1},dy[10]={1,0,-1,0,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};
int px[10]={-1,1,1,-1,1,1,-1,-1},py[10]={1,1,-1,-1,1,-1,1,-1};
long long mod=1000000007,mod2=1000000009,mod3=2017;
long long x,z,y;
double pi=3.14159265;
P u[111111];
stack<int> s;
//set<int> s,s1;

//priority_queue<int> q;
queue<int> q;
//string r;
char r[211111],r1[11],r2[11];
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p;
//v.resize(unique(v.begin(),v.end())-v.begin());
/*struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
unordered_map<long long, int, custom_hash> p;//safe_map;
*/
bool as(P a,P b)
{
    //if(a.x!=b.x)
    //return a.x<b.x;
    return a.y<b.y;
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//rng();

long long f(long long x,long long y)
{
    long long p=1;
    for(;y;x*=x,x%=mod,y/=2)
    if(y%2) p*=x,p%=mod;
    return p;
}

int main()
{
    o[0]=l[0]=j[0]=1;
    scanf("%d %d",&a,&b);
    z=f(2,mod-2);
    for(int t=1;t<=200010;t++)
        j[t]=j[t-1]*z%mod,o[t]=o[t-1]*t%mod,l[t]=f(o[t],mod-2);
    for(int t=0;t<min(a,b);t++)
        printf("%lld\n",z);

    for(int t=min(a,b);t<max(a,b);t++)
    {
        if(a>b)
        {
            //if(t>min(a,b)+1)
            x=(x+o[t-1]*l[t-b]%mod*l[b-1]%mod*j[t]%mod)%mod;
            printf("%lld\n",(1+x+mod)*j[1]%mod);
        }
        else
        {
            //if(t>min(a,b)+1)
            y=(y+o[t-1]*l[t-a]%mod*l[a-1]%mod*j[t]%mod)%mod;
            printf("%lld\n",(1-y+mod)*j[1]%mod);
        }
    }
    for(int t=max(a,b);t<a+b;t++)
    {
        x=(x+o[t-1]*l[t-b]%mod*l[b-1]%mod*j[t]%mod)%mod;
        y=(y+o[t-1]*l[t-a]%mod*l[a-1]%mod*j[t]%mod)%mod;
        printf("%lld\n",(1+x-y+mod)*j[1]%mod);
    }
}