5293: Cannon

内存限制:256 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

ZYT found a chessboard with two rows and 101000 columns, and there are some cannons in it - x cannons in the first row and y in the second row. 

In Chinese Chess, if a cannon and another piece (let’s call it A) are in the same row or column, and there is exactly one other piece in between, this cannon can capture A and move to A's original position.(In this problem, in order to keep the situation simple, we think that a cannon can capture any piece except itself, without considering which side it belongs to. ) 

Now, ZYT has performed a series of operations on these cannons. Define an operation (li,ai,bi)(li,ai,bi) as the aithaith cannon currently counting from left to right in the lithlith row has eaten the bithbith cannon of the same row, where 1≤ai,bi≤c,∣ai−bi∣=2,l∈{1,2}1ai,bic,aibi=2,l{1,2}(cc is the number of cannons in this row). Define an operation sequence as an ordered arrangement of a series of operations. 

ZYT wants to get many different sequences of operations. He is bored, so he wants to know how many different operation sequences can be generated for ii operations. 

Specifically, he wants to know how many different operation sequences can be generated for i times under the following two rules: 
  1. ZYT can perform any operation that meets the above rules. 
  2. In all operations performed by ZYT, there are no two integers p,q, satisfying 1≤p<q≤i and lp>lq
Since ZYT didn’t want to see a lot of output data, he asked to output the answer in the following way: For each question, let fifi be the number of legal operation sequences obtained by operating ii times modulo 109+9 .Please output f0⊕f1⊕⋯⊕fx+y−4, where  represents an exclusive OR operation.

输入

The input consists one line containing two integers xx and yy.

输出

Output one line, containing two integers, representing the answers under the first and second rules.

样例输入 复制

3 4

样例输出 复制

47 7

提示

For all test cases, it is guaranteed that 2≤x,y≤5×1062x,y5×106.