문제
Cow Land is a special amusement park for cows, where they roam around, eat delicious grass, and visit different cow attractions (the roller cowster is particularly popular).
There are a total of
A cow that travels from attraction
Please help the cows determine the enjoyment values of the routes they plan to use during their next trip to Cow Land.
Problem credits: Charles Bailey
입력
The first line of input contains
In test data worth at most 50% of points, there will be no changes to the values of the attractions.
출력
For each query of the form "2
예제1
5 5
1 2 4 8 16
1 2
1 3
3 4
3 5
2 1 5
1 1 16
2 3 5
2 1 5
2 1 3
21
20
4
20