690_D2. The Wall (medium)
Heidi the Cow is aghast: cracks in the northern Wall? Zombies gathering outside, forming groups, preparing their assault? This must not happen! Quickly, she fetches her HC2 (Handbook of Crazy Constructions) and looks for the right chapter:

How to build a wall:

  1. Take a set of bricks.
  2. Select one of the possible wall designs. Computing the number of possible designs is left as an exercise to the reader.
  3. Place bricks on top of each other, according to the chosen design.



This seems easy enough. But Heidi is a Coding Cow, not a Constructing Cow. Her mind keeps coming back to point 2b. Despite the imminent danger of a zombie onslaught, she wonders just how many possible walls she could build with up to n bricks.

A wall is a set of wall segments as defined in the easy version. How many different walls can be constructed such that the wall consists of at least 1 and at most n bricks? Two walls are different if there exist a column c and a row r such that one wall has a brick in this spot, and the other does not.

Along with n, you will be given C, the width of the wall (as defined in the easy version). Return the number of different walls modulo 106 + 3.

Input

The first line contains two space-separated integers n and C, 1 ≤ n ≤ 500000, 1 ≤ C ≤ 200000.

Output

Print the number of different walls that Heidi could build, modulo 106 + 3.

Examples

Input

5 1


Output

5


Input

2 2


Output

5


Input

3 2


Output

9


Input

11 5


Output

4367


Input

37 63


Output

230574

Note

The number 106 + 3 is prime.

In the second sample case, the five walls are: 
    
    
      
                B        B  
    B., .B, BB, B., and .B  
    

In the third sample case, the nine walls are the five as in the second sample case and in addition the following four: 
    
    
      
    B    B  
    B    B  B        B  
    B., .B, BB, and BB  
    
```python
result=0
mod=10**6 +3
n,C=map(int,input().split()) #recibimos la entrada 
#calc n!
def fact(n):
    fact=1
    for i in range(1,n+1): #1*2*3*...*n = n*(n-1)*(n-2)...*1
        fact=(fact*i)%mod #
    return fact

def pow(a,b): #Algoritmo de Exponenciacion binaria
    exp=1 # Caso base a^1=a
    x=a % mod
    b=b%(mod-1)
    while b > 0: 
        if b % 2 == 1:# En caso que b sea impar
            exp=(exp*x)%mod
            # En caso que b sea impar
        x=(x*x)%mod
        b=b//2
    return exp    

#cacl (n+C)!/(n!*C!) , usamos el pequenno teorema de Fermat a^{p-1}congruente 1(p) a^{p-2}congruente a^{-1}(p)
# de esta forma en vez de 1/n! y 1/C! usamos n!**p-2 C!**p-2 en este caso p=mod 
result=fact(n+C)*pow(fact(n),mod-2)*pow(fact(C),mod-2)-1 # C(n+C,C)= n+C!

print(int(result%mod))
```