CF1374A Required Remainder

题目描述

输入$x,y,n(2\le x\le10^9,0\le y

输入格式

第一行,一个数$t$ 第$2$到第$t+1$行, 每行一组$x,y,n$

输出格式

一行一个满足条件的非负整数$k$ 可以证明在给定的条件下, $k$一定存在

说明/提示

In the first test case of the example, the answer is $ 12339 = 7 \cdot 1762 + 5 $ (thus, $ 12339 \bmod 7 = 5 $ ). It is obvious that there is no greater integer not exceeding $ 12345 $ which has the remainder $ 5 $ modulo $ 7 $ .