2108 - [Wc2009]语音识别

Input

Output

Examples

Input

6 5 1
3 3 3 1 2 0
1 1
2 1 2
1 0
2 3 3
2 2 0

Output

5 14
3 3
时间限制 1 秒
内存限制 128 MB
统计
上一题 下一题