Basketball

Time limit: 0.5s Memory limit: 128MB Input: Output:

In Scundu, two boys were playing basketball. They are not very good at the game, so they got bored and decided to rest on a bench. While sitting there, they wondered: if a game of basketball ends with the score AA and BB, where AA is the score of the first team and BB is the score of the second team, in how many ways can this score be obtained? Because they are not very good at programming either, they need your help to find out.

In Scundu, the basketball rules are the following: depending on the striking distance, each team can get either 2 or 3 points for introducing the ball in the basket. Because scundenians are superior people, we consider that faults will never occur.

Input data

The input contains two integers AA and BB (0A,B500 0 \le A, B \le 500), where AA is the score of the first team and BB is the score of the second team.

Output data

The output contains one integer XX, the number of ways that score can be obtained. Because the number of ways can be very big, the number of ways should be printed modulo 1 000 000 0071 \ 000 \ 000 \ 007.

Constraints and clarifications

  • For 3030 points, we have 0A,B10 0 \le A, B \le 10;
  • For another 2020 points, we have A=0A = 0 or B=0B = 0;
  • For the last 5050 points, we have 0A,B500 0 \le A, B \le 500.

Example 1

stdin

2 5

stdout

6

Explanation

The ways we can obtain the score are the following:

00 to 020 \rightarrow 2 to 020 \rightarrow 2 to 323 \rightarrow 2 to 55
00 to 020 \rightarrow 2 to 020 \rightarrow 2 to 222 \rightarrow 2 to 55
00 to 000 \rightarrow 0 to 323 \rightarrow 2 to 323 \rightarrow 2 to 55
00 to 000 \rightarrow 0 to 303 \rightarrow 0 to 525 \rightarrow 2 to 55
00 to 000 \rightarrow 0 to 222 \rightarrow 2 to 222 \rightarrow 2 to 55
00 to 000 \rightarrow 0 to 202 \rightarrow 0 to 525 \rightarrow 2 to 55

Log in or sign up to be able to send submissions!