Server Time: Sat Sep 26, 2020 10:28 am
Welcome ( logout
A - We Do Business
PDF (English) Ranklist
Time Limit: 2 second(s) Memory Limit: 32 MB

We Do Business

Mr. Lulu is a businessman. He buys things from a country and sells them to other. But he has some interesting habit. He always buys countable things and in such a way that each of the different items are same in number. Like a good businessman he always tries to predict his profit or loss. But there are some problems. The unit of buying and selling are not equal in every country. For example, in our country unit of buying & selling eggs is “Hali”(4 eggs consist a Hali). But in the country Far Far away, unit of buying & selling eggs is “Heptly”(7 eggs make a Heptly). Of course, you can trade a fraction of an unit, like 0.5 hali, that means 2 eggs. And Mr. Lulu only knows the number of things that defines a unit of different places and the cost of one unit (cost of one Hali or Heptly). At a time Mr. Lulu considers two countries. He buys things from the first country and sells all of them in the second one. He is a good mathematician but also a great idle. He hates to do this annoying calculation and requested you to write a program to do the job.



            The input will have several test cases. The first line will denote the number of test cases T. Then T test cases will follow. Each test case will start with an integer N which denotes how many different things Mr. Lulu is considering. Each of the following N lines will have the format U1i P1i U2i P2i where U1i and P1i denotes the number of things that defines a unit and price of one unit of the i-th thing in the first country and U2i and P2i represents the same information of i-th thing in the second country respectively. You may assume that (N<100000) and (0<U,P<=1000) and prices are in same currency.



            For each test case print “Trade #k: ” where k will be replaced by the case no. starting from 1. Then print “x% Profit” if there is profit in the trade, “x% Loss” if there is loss in the trade, (x will be replaced by appropriate value rounded to two digits after decimal point). If there is neither profit nor loss print the phrase “Kolur Bolod” without quotation instead. See sample output for details.


Sample Input:



1 1 1 2


1 2 1 1


1 1 1 1


5 7 8 10

8 10 5 7

13 16 25 100

25 100 13 16


Sample Output:

Trade #1: 100.00% Profit

Trade #2: 50.00% Loss

Trade #3: Kolur Bolod

Trade #4: Kolur Bolod



Problem Setter: Md. Towhidul Islam Talukder
Special Thanks: Shahidul Islam
Developed and Maintained by
Copyright © 2012
LightOJ, Jane Alam Jan