Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

C24E08FT - EC08F Farming (T)

Your task in this problem is to satisfy the curiosity of farmer Mr. Boggis by calculating how many ways he could plan cultivation for the next five years.

Mr. Boggis owns seven (distinguishable) parcels of excellent quality field. Each year, he grows one of three kinds of crops on each of the seven parcels. The parcels cannot be further subdivided. He has been doing this for two years now, and wants to plan now which kind of crop he will grow in each field the next five years.

We call the three kinds of crops 0, 1, and 2. Boggis lives in a country with a very stable economy, so each year the demand for the three products are the same. For this reason, he has to produce crop 0 on exactly two parcels of land, crop 1 on exactly two parcels, and crop 2 on three parcels.

Mr. Boggis values variety, so he refuses to do the same thing any two years. Thus, in any two years (not only adjacent ones), he will have at least one parcel that he uses differently.

For conserving the soil in best quality, Mr. Boggis has decided that he will use each parcel evenly, which means that during the seven years we are examining, each parcel has to be used for growing crop 0 exactly two times, crop 1 exactly two times, and crop 2 exactly three times.

Finally, Boggis has to take care not to use two parcels exactly the same in the seven year period, for because of the arcane laws in his country, that would have count as "industrial scale cultivation", which implies very high taxes. Thus, for any two parcels, there has to be at least one year out of the seven years when a different crop is grown on them.

Mr. Boggis tells you what he did in the two years that have passed. From this, you must calculate the number of different production plans he could follow in the remaining five years.

Input

The input file contains two lines. Each of the lines have exactly seven decimal integer between 0 and 2 (inclusive), separated by spaces. The Jth number in line I is the plant produced on field J in the Ith year.

Output

The output must be a file of a single line, which contains a single decimal integer: the number of possible plans. 10

This is the text variant of the problem. Read more here about submitting solutions!

Example

Input
2 0 0 2 1 1 2
2 0 0 1 1 2 2
Output
384240

Added by:Jacek DÄ…browski
Date:2009-02-04
Time limit:0.200s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C++ 4.3.2 TEXT
Resource:Challenge 24 2008 Electronic Contest

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.