#C5985. Prime Addition Challenge

    ID: 49694 Type: Default 1000ms 256MiB

Prime Addition Challenge

Prime Addition Challenge

You are given a number of test cases. For each test case, you are provided with two integers \(N\) and \(M\).

Your task for each test case is to:

  • Find the smallest prime number greater than \(N\). Let this prime be \(P\).
  • Calculate the sum of the digits of \(M\), denoted by \(S\).
  • Output the value \(P + S\).

Note that a prime number is an integer greater than 1 that has no positive divisors other than 1 and itself.

For example, for the test case where \(N = 10\) and \(M = 123\), the smallest prime greater than 10 is 11 and the sum of the digits of 123 is \(1+2+3=6\). Hence, the answer is \(11+6=17\>.

inputFormat

The first line contains an integer \(T\) representing the number of test cases.

Each of the following \(T\) lines contains two space-separated integers \(N\) and \(M\).

outputFormat

For each test case, output the result (\(P+S\)) on a new line.

## sample
1
10 123
17

</p>