LearnPy Hub
← Arena
AdvancedRating 2100

Maximum Water Flow

Pipes carry water one way, each with a capacity. Print the most water per second that can flow from node 1 to node n.

Input

n (≤ 50) and m; then m lines 'u v capacity'.

Output

One integer.

Sample 1

Input
4 5
1 2 3
2 4 2
1 3 2
3 4 3
2 3 5
Output
5

Sample 2

Input
2 0
Output
0
solution.py
Output appears here
Maximum Water Flow · Python Arena problem · LearnPy Hub