ntopia

Count the number of ways to assign 1, 2, or 3 of three singers to each of S songs so each singer reaches a given song count.

Medium7CombinatoricsMathNo attempts yetTime limit2sMemory limit512 MB

Problem

dotorya, kesakiyo, and hongjun7 teach at an algorithm camp, and the three of them formed an idol group named ntopia.

The debut album of ntopia holds SS songs. Every song must be sung by at least one of the three. Two of them may sing a song together, and all three may sing one together.

Given the number of songs each of the three has to record, write a program that counts the ways to make the album.

Album AA and album BB are different albums if there is at least one song whose singers differ between them.

Input

The first line contains the number of songs on the album, SS, followed by the number of songs that dotorya, kesakiyo, and hongjun7 each have to sing, separated by spaces. (1S1061 \le S \le 10^6, and each of the three song counts is between 11 and SS.)

Output

Print on the first line the number of ways to make the album, modulo 1,000,000,007.