2834 - 回家的路

Input

Output

Examples

Input

2 1
1 2
1 1 2 2

Output

5

Hint

N<=20000,M<=100000

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