Ross and UNAGI

4

3 votes
Easy-Medium
Problem

enter image description here

Rachel and Phoebe are sick of Ross trying to teach them the importance of UNAGI and decide to give him a problem to keep him busy . Ross asks for your help to solve the problem :

You are given Q queries containing two integers a,b . Your task is simple. Calculate sum of prime factors of
(abc + 1)%m where m is 106+3

Input :

First line contains single integer Q .
Next Q lines contain three spaced integers a,b,c.

Output :

For each query output the answer in a new line.

Constraints :

1Q106

0a,b109

0c1018

Problem Setter - Vaibhav Bansal

Time Limit: 3
Memory Limit: 256
Source Limit:
Editor Image

?