 Alright guys, we're going to go over the next problem of 645 to C. So during quarantine, he wants to create new functions of selects 2021. The developers made this function, gasgiz, which is an infinite table to the right and a corner like this. Okay, sells with the coordinates x, y, start at the intersection of the row x and y column, one one upper left starts with one one integer one, developers of some function don't sleep either. So they claim up with the grand function, which is where they took to go from one cell to the other, you could only go right or go down, right? So if you could only go right, and you go down, right, go down, right, go down. Okay. So then now consider the paths from x one to y one cell to the x two y two cell, such that the next path next cell in the path is located either down or to the right one. So now we got to calculate the minimum number of not minimum calculated number of different sums of elements of all such paths. All right, so to understand this problem, we have to actually draw this out. And just with three by three grid first, and then we'll see what what the answer would be like, you have to draw this out and see like which path to find the different number of paths, different sums of elements for each path. Okay, so I'm going to draw it out with you guys right now. Okay guys, so let's just label each, each number in this grid and see which the paths are. Okay, so like let's say how about we just use a three by three for now because going for a large one takes too much time. Okay, so let's just see how the pattern actually works. First, because some of you guys might I didn't even notice this during when I saw the the contest. Okay, so if you can notice here, the pattern actually works like this, you have one, and it goes to two, then it goes to three, then you have four, then it goes to five, then it goes to six. And then if there's more here, there should be a seven, then it goes to eight, it goes to nine, and then 10, 11, 12, 13, yada, yada, yada. So pretty much this path. Now let's try to think about ways how we could go from one cell to another. Okay, so if we start at this cell x 1111, so 11, let's label these rows and columns. Okay, whoops. All right. Let's just see what the sum of the paths would be if I were to go from 11233 for this one, right? So I want to go from 11233. So I want to go 11233. So what can I do? Well, I'm going to go right and then go down and then right, go down, right? So let's just go all rights and then all downs first. So if I were to start from one, and I'm going to go all right, I'm going to add all the sums from there all to the right, then go all add all the sums go down. Alright, so I'm going to do one plus two plus four plus eight plus 13. And that'll be one path. Okay, so this is going to be like one one path. Now let's say if I were instead of going all right, and then go down, I'm going to go to the right, and then go down once, right? Just go instead of going all right and go down, we're going to go to the right and they go down once, and then go right and then go down. Okay, then go all the way right and then go down. Okay, so that's what we're going to do. So let's let's let's find out this path now. So this path. Well, this path is one plus two plus five plus eight plus 13. Well, wait a minute, look at this, it's the path from here, compared to the first path is just one more than the last path. Right. So if you were to go down instead of going like all the way right, and you go down, you would, you're increasing it by one. So let's let's let's look at this again. Let's look at another one. Let's let's add instead of going right, right, all rights, and then all downs and always and now we're going to go one, one down. So I'm going to label that as like R to right, and then down as going down. So that so in this case, for the for the first case, we went right, right, right, and then down, down, down, right. So that was right, right, right, and then down, down, down. In the second case, we went right down, right? And then down, we went right, right down, right down, right down, right down, right? Okay, yeah, right, right? Down down. Oh, wait, Whoops, I put too much on the first one, right? Write down, down. All right. So the first one is right, right, down, down. So now the second one, we went right down, right down. Okay, now for the third one, let's go down and then all rights and then down. So we're going to to go down, then all rights down to rights and then one down. Okay, so what is that? That's one, one plus three plus five plus eight plus 13. So one plus one plus three plus five plus eight plus 13 would get us to 33. And this sum is also just one more than the previous sum. As you can see here, right? So now let's instead of now let's go now let's go all downs and then all to the rights. So let's see what that gives us. We go all downs one, one down, down again. And then two rights, we get one plus three plus six plus nine plus 13. Okay, so that that gave us the one right one down one right, right down. Yeah, so this gave us two more. And it's because like I we needed one. I think I missed one down down down right right, right? One down. Oh, yeah, I missed one down right down right down right down right. Yeah, I missed one by bad. So we're going to go down right down right. Yeah, I miss one one plus three plus five plus nine plus 13. And then that sets one more than this one. And then we go down, down, right, right, one plus three plus six plus nine plus 13. Yeah, so that so all these paths are just one more than the previous path. So the smallest path is going to go be all the just keep going right and then all downs, like the first one, right, keep going right and then all downs and the largest path is going to be all downs and then all rights, right. So that that's, that's the, the number that we're going. So now let's think about how many number of downs and how many rights are there for the first one. Well, simple, this is just going to be the difference between the number of columns. So the number of rights I'm going. So in the first one, we're going to write right down down. This is going to be the difference between number of columns, we went right, right two times. And that's the difference between three and one, right? We went right right two times. That's three and one. And then we went down down two times down down two times. And that's the difference between. Yeah, that's also the difference between three and one also. So that's the one three one three and three three. Yeah, okay. So yeah, that's also the difference between three and one. So in this case, the number of rights and the number of downs are going to be the difference between the number of rows, or the difference between the number of columns, right? So if I'm going to go from right, right, and then down, down, and then right down, right, down, and then down, right, right, down, down, right, down, down, down, right, right. I have to, I'm key, I'm multiplying the, the I'm going through every single difference of rows and the difference of columns. So in the first case, we had, we're going from one one to three three. So the difference of rows is going to be, so let's x one y one x two y two, right, x two y two is the one we're getting at. It's going to be the difference of rows, multiplied by the difference of columns. Okay, because that's going to be the total different number of ways I could get from here to here. And then that's, that'll be the total different number of ways, but I also have to keep track of the first one, the first one I'm cleaning. So I have to add one. Okay, so that's, that's pretty much how you would do this question. You would have to, you have to draw out the difference of what you're going through. And the total number of ways you have to calculate it, based on the drawing out, drawing it out, and then trying to find the pattern. Okay, so that's, that's how you do this problem. Yeah, I'll show you the code. And then that's pretty much it. Yeah. All right, guys, so this is the code. You're just all you have to do is just read in the number of test cases. While the number of test cases going down, you're going to read in x one y one x two y two. And then you're going to subtract y two minus y one and multiply x two minus x one. And then that'll be the number of different ways. And you also have to add one to include the first case. So then that's, that's it. Yeah, that's how you do this problem. Great. Come subscribe and check you guys later. Peace.