Pasquale’s Tryangle

SAMPLE INPUT

3

4

1

2

3

4

3

30

-5

-10

6

1

1

1

1

1

1

SAMPLE OUTPUT

42

0

132

EXPLANATION
The first Pasquale's Tryangle is in box above. Here is the second Pasquale's Tryangle:

30

-5 

-10

15

-15

 

0

 

 


Here is the third Pasquale's Tryangle:

 

1

1

1

1

1

1

6

5

4

3

2

 

20

14

9

5

 

 

48

28

14

 

 

 

90

42

 

 

 

 

132