守卫 Guards

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=278&page=show_problem&problem=3793 [PDF](https://uva.onlinejudge.org/external/123/p12371.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12371/56ee60e1086545cf623517834e542f3eaaf7395e.png)

输入输出格式

输入格式


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

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12371/23dec68c665cce3888f3d8e927439649e18f3f6f.png)

输入输出样例

输入样例 #1

4
2 1
3 1
4 1
4 2

输出样例 #1

Case 1: 1
Case 2: 6
Case 3: 72
Case 4: 18