Problems
10029 - Ways
SUBMIT PROBLEM

Ways

Time Limit: 1 sec

 

The Problem

Rock climbing is an interesting physical work. A rock climbing competition is going on. There are several ways to climb & reach the target point.

You need to find the shortest path for climbing to win the race from different paths.

 

Example:

3 ways are given

133 = 1 + 3 +3 = 7

333 = 3 + 3 +3 = 9

411 = 4 + 1 + 1 = 6

As 6 is the smallest.

The shortest path is Path No. 3

 

The Input

The input file contains several cases. Each case contains an integer N (N<=100) and N following lines of numbers. The number could have maximum a value of 10 digits. Input is terminated by EOF.

 

The Output

For each case print the shortest path no in a separate line.

 

Sample Input

3

133

333

411

5

523

229

555

666

199

 

Sample Output

Path No 3

Path No 1

 

 

 

[School Level]

1st Online Programming Contest 2016 by Outsbook

Problem Setter: Samia Safa Ahmed