网格中的三角形 Triangles in the Grid

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=441&page=show_problem&problem=3952 [PDF](https://uva.onlinejudge.org/external/125/p12508.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12508/5aa1841ba6288d38e2087ab3d384080ed5c49355.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12508/22a680b052518d21246a47fb5d2027ed8367636e.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12508/ed03a717dd3bc59bccdd937b51432eba87598c70.png)

输入输出样例

输入样例 #1

4
1 1 0 1
1 2 1 2
10 10 20 30
12 34 56 78

输出样例 #1

4
6
27492
1737488