Maximum Flow 2#1712

Maximum Flow 2

1 second
64 megabytes
Easy

You are given a directed graph . Each edge has a specified capacity. Find the maximum flow from vertex to vertex .

Input

The first line contains two integers and (2 \leq n \leq 500, 1 \leq m \leq 10000) — the number of vertices and the number of edges in the graph. Each of the next lines describes an edge with three integers: the starting vertex, the ending vertex, and the capacity of the edge. The capacity of each edge does not exceed 10^9.

Output

Output the value of the maximum flow from vertex to vertex .

Examples

Example 1

Loading
Loading