Hello Programmers In this post, you will know how to solve the **Tojo hates probabilities Codechef Solution**. The Problem Code: **ANUTHM**

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

### Problem

As a holiday gift, Tojo received a probability problem. The problem read as follows

Consider an **N** by **M** grid. Rows are numbered **1** to **N**, from top to bottom. Columns are numbered **1** to **M**, from left to right. You are initially at cell (1, 1) and want to go to cell (**N, M**). From any cell you can move to the cell below it or to the cell right to it. You should never go out of the grid. At any point you should consider all the possibilities of movement with equal probability

Let P[i][j] be the probability of visiting cell (i, j). You need to calculate the sum of P[i][j] for **1** ≤ **i** ≤ **N**, **1** ≤ **i** ≤ **M**.

As we all know, Tojo really hates probability-related problems. He wants you to solve this task

### Input

The first line of the input contains an integer **T** denoting the number of test cases. The description of **T** test cases follows.Only line of each test case has two integer **N** and **M**.

### Output

For each test case, output a single line containing the required answer. Answers within an absolute or relative error of 10^{-6} will be accepted.

### Constraints

**1**≤**T**≤**1000****1**≤**N**≤**1000****1**≤**M**≤**1000**

### Example

### Sample Input 1

```
2
2 2
1 6
```

### Sample Output 1

```
3.000000
6.000000
```

### Tojo hates probabilities CodeChef Solution in JAVA

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int tc = 0; tc < T; tc++) { int N = sc.nextInt(); int M = sc.nextInt(); System.out.println(solve(N, M)); } sc.close(); } static int solve(int N, int M) { return N + M - 1; } }

** Disclaimer: **The above Problem

**(Tojo hates probabilities )**is

**generated by**

**CodeChef**but the solution is provided by

**BrokenProgrammers**. This tutorial is only for Educational and Learning purposes.

**Note:-** I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

**Next**: Suraj goes shopping Codechef Solution