# DCP-452: Number Pyramid Back to All Problems

Medium Math > Basic Math

You probably heard of number pyramid. Its looks like this: ![enter image description here][1] Easy and cute, isn’t it? Now You have to find summation of a sub triangle. For example: ![enter image description here][2] Edge of this sub-triangle is - row 2, column 2 and value 3 - row 4, column 2 and value 8 - row 4, column 4 and value 10 And summation of this sub-triangle is 41. You can assume the sub-triangle to be equilateral triangle, Every side of the sub-triangle contains same amount of numbers. And the result should be a positive number. Input: ------ Input starts with an integer **T (1<= T <=3000)**, denoting the number of test cases. Each case contains 3 lines, denoting the **3** points of the triangle. Each Line will have **2** numbers: **X** and **Y** , denoting a point of the sub-triangle. You can safely assume that all point of triangle will be valid and **1** <= **Y** <= **X** <= **3000** . Point **X** , **Y** means number of **X** th row and **Y** th column. They are not necessarily ordered. Output: ------- For each case of input, output the summation of the sub-triangle modulo 1E9 + 7 ( 1000000007 ) Sample Input ------------ 2 2 2 4 2 4 4 1 1 2 1 2 2 Sample Output ------------- 41 6 [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/d95dd904-ac1e-c7e1-2144-08d53bfa26ec_ebfcf2ea60ad4289b8e9723ef16407d2_W297xH160.png [2]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/c2afb591-fa89-cd57-d820-08d53bfa31c0_375f978bfa5c454596ad3cbb031cca11_W263xH145.png

### Problem Limits

 Language Time Limit (seconds) C 1.00 C++ 1.00 C++14 1.00 C# 2.00 Go 2.00 Java 2.00 JavaScript 2.00 Objective-C 2.00 Perl 2.00 PHP 2.00 Python 2.00 Python3 2.00 Ruby 2.00 VB.Net 2.00

# 49/264

Solve/Submission

### Ranking

# User Language Timing
01 feodorv C 0.01s
02 Mohimenol_Fahim Cpp 0.03s
04 islam2366 C 0.03s
05 Mushfiqur_Rahman Cpp 0.03s
06 Asif_Watson Cpp 0.05s
08 shamimjucse Cpp 0.05s
10 sakib_cse17 Cpp 0.06s
11 fayedanik Cpp14 0.06s
12 pencil Cpp 0.06s
13 mahbubcseju Cpp 0.09s
14 PKP_007 Cpp 0.09s
15 Rajib_119 Cpp 0.09s
16 SAIF_IIT8_JU Cpp 0.09s
17 kabbya Cpp 0.10s
19 neel71 Cpp14 0.12s
20 shahjalalshohag Cpp14 0.12s
21 tahsin_protik Cpp 0.12s
22 mir003 Cpp 0.13s
23 tariqiitju Cpp14 0.13s
26 mh755628 Cpp14 0.22s
27 sayedgkm Cpp14 0.23s
28 DynamicOvi Cpp 0.25s
29 warriors_of_7 Cpp 0.26s
30 _c_k_r_ Cpp 0.26s
31 snow_man Cpp14 0.26s
32 Nobel Cpp 0.28s
33 Masum_ice Cpp 0.34s
34 Robin008 Cpp 0.35s
35 anik_JU Cpp 0.39s
37 emrul Cpp14 0.42s
38 ksohan Cpp 0.44s
39 Taran Cpp14 0.44s
40 SakibAlamin Cpp14 0.48s
41 Ishraq_Nibir Cpp 0.60s