PERT is a project management technique that splits a large project into tasks, fixes how long each task takes, and records which tasks must finish before another task may start. The result is drawn as a chart.

The picture above is the chart for the first sample input. Tasks A, B, C, D, E, and F take 5, 3, 2, 2, 4, and 2 days. Task E starts only after both C and D are finished, and once A is finished, B and D can run at the same time. Any number of tasks that do not wait for each other run at the same time.
Given a chart, write a program that computes the minimum time needed to finish the project.