Cities on a map are connected by a number of roads. The number of roads between each city is in an array and city is the starting location. The number of roads from city to city is the first value in the array, from city to city is the second, and so on.
How many paths are there from city to the last city in the list, modulo ?
There are roads to city , roads to city and roads to city . The total number of roads is .
Pass all the towns Ti for i=1 to n-1 in numerical order to reach Tn.
Complete the connectingTowns function in the editor below.
connectingTowns has the following parameters:
int n: the number of towns
int routes[n-1]: the number of routes between towns
int: the total number of routes, modulo 1234567.
The first line contains an integer T, T test-cases follow.
Each test-case has 2 lines.
The first line contains an integer N (the number of towns).
The second line contains N - 1 space separated integers where the ith integer denotes the number of routes, Ni, from the town Ti to Ti+1