In the Geek's land, their lives a very rich geek Siri. For her undergraduation studies she joins a Engineering college, in the Geek's land. The college has its own rules and regulations for student's discipline.The college also has a semester wise system, a semester being of K day's. Siri disliked one rule of the college that "Students should maintain a Compulsory attendance of 75%, otherwise students get Debarred".
College had a very clever formula of calculating attendance of a particular student.
Attendance of a Semester = (Total number of days student's present in the college on a particular day / Total number of days in a semester ) * 100%
Before her first day for the college Siri and her mom went to market for shopping and bought N dresses. Mom told her that every Mth day she will bring her a new dress, but since the shop's in the Geek's land is open only in the evening, so Siri could only wear the new dress next day. If on a particular day Siri didn't had a dress to wear that she hadn't worn in the past so she bunk's that day of the college. Now Siri is curious to know that what will be her attendance at the end of the semester. To calculate attendace at the end of the semester she wants to know for how many day's will she bunk her classes in a semester of K day's. Being weak in maths she has came to her best friend for help. Being her best friend help her out with her problem.
First line of the test case contains an integer T, denoting the number of test cases. Then T test cases follow. Only line of each test case contains three space separated integers N, M and K respectively.
For each test case output a single line containing a single integer denoting the number of day's siri will bunk her college in a semester.
9 3 15
50 5 65
2 2 10
Initially Siri has 9 dresses which she could wear for 9 consecutive days, between these 9 days her mother get's her 3 more dresses which she will wear for 3 more days and at the 12th day her mother bring's her one more dress which she could wear next day. Since now siri don't have any dress to wear to college next day, so she bunk's the college till she get's a new dress. Since she will get a new dress on 15th day but 15th day is the last day of the semester. Hence she total bunks for 2 day's in the semester.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.