{"raw_statement":[{"iden":"problem statement","content":"You are given six integers: $h_1, h_2, h_3, w_1, w_2$, and $w_3$.  \nConsider writing a **positive** integer on each square of a $3 \\times 3$ grid so that all of the following conditions are satisfied:\n\n*   For $i=1,2,3$, the sum of numbers written in the $i$\\-th row from the top is $h_i$.\n*   For $j=1,2,3$, the sum of numbers written in the $j$\\-th column from the left is $w_i$.\n\nFor example, if $(h_1, h_2, h_3) = (5, 13, 10)$ and $(w_1, w_2, w_3) = (6, 13, 9)$, then all of the following three ways satisfy the conditions. (There are other ways to satisfy the conditions.)\n![image](https://img.atcoder.jp/ghi/42e99457e52ca5e6d335b2dbda72d9ab.png)\nHow many ways are there to write numbers to satisfy the conditions?"},{"iden":"constraints","content":"*   $3 \\leq h_1, h_2, h_3, w_1, w_2, w_3 \\leq 30$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$h_1$ $h_2$ $h_3$ $w_1$ $w_2$ $w_3$"},{"iden":"sample input 1","content":"3 4 6 3 3 7"},{"iden":"sample output 1","content":"1\n\nThe following is the only way to satisfy the conditions. Thus, $1$ should be printed.\n![image](https://img.atcoder.jp/ghi/d53ea47321716fe799854c72b7beff3c.jpg)"},{"iden":"sample input 2","content":"3 4 5 6 7 8"},{"iden":"sample output 2","content":"0\n\nThere may not be a way to satisfy the conditions."},{"iden":"sample input 3","content":"5 13 10 6 13 9"},{"iden":"sample output 3","content":"120"},{"iden":"sample input 4","content":"20 25 30 22 29 24"},{"iden":"sample output 4","content":"30613"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}