Home Web Board ProblemSet Standing Status Statistics
long long输出请使用 %lld服务器的python版本为3.4
Problem G: 贸易路线

Problem G: 贸易路线

Time Limit: 1 Sec  Memory Limit: 256 MB
Submit: 19  Solved: 6
[Submit][Status][Web Board]

Description

Input

Output

Sample Input

4 6
1 1 2 1
2 1
1 2 3 2
2 3
1 1 3 3
2 2

Sample Output

1
2
6

HINT


[Submit][Status][Web Board]