Money Bank is an investment bank. It gives money to the companies for their operation that approach it. The bank's officers have to calculate the maximum amount that the company can be given, based on the company's market value and its market rating published by Global Rating Companies. The maximum amount will change on a daily basis as per the change in the company's shares, its market value and its change in rating. Based on the maximum amount allocated, the bank internally calculates the amount that the company can use on a particular day. The maximum amount that the bank will give at any point is 50% of the company's value, which will decrease as per the change in the company's rating.
Company ABC has 25734 shares in the market. The current value of the share is 77 INR. The change in the Share Value from yesterday is +10(or 10) Today's rating of ABC is 87 (out of 100). The change in rating from yesterday is +2 (or 2). The credit and risk calculator will work in the following way-
Similarly, company XYZ has 30000 shares in the market. The current value of the share is 90 INR. The change in the Share Value from yesterday is -15. Today's rating of XYZ is 83 (out of 100). The change in rating from yesterday is -4. The credit and risk calculator will work in the following way-
No. Of Shares (N)
Share Value (SV)
Change in Share Value (CSV)
Previous Share Value (SV') = SV-CSV
PCompany Value (CV) =N*min (SV, SV')
Company Rating (R)
Change in Rating ( CR)
Previous Rating (R')= R-CR
PMax Credit Company is Eligible for (CE) =CV * (50%)
PCredit Allotted (CA) = CE * (min(R', R)/100)
= 25734 * 67
= 1724178.00 *0.5
= 862089 * 0.85
Input Format:(All black color headings are input in above table)
First line contains total number of test cases T
Each test case comprises of
First line contains number of shares N
Second line contains current share value SV
Third line contains change in share value CSV
Fourth line contains current rating R
Fifth line contains change in rating CR
Output Format:(All blue color headings are output in above table)
In case of Valid inputs, print the following per line
Previous Share Value SV'
Previous Rating R'
Company Value CV
Maximum Credit CE
Credit Allotted CA
Print "Invalid Input" in case of invalid input(s)
Highest Priority Constraint
Share Value (SV and SV') can never be negative
Input related constraints:-
1 <= T <=100
20000 <= N <= 10000000
20.00 <= SV <= 10000.00 (Note:- This is a numerical constraint only)
-2000.00 <= CSV <= 2000.00 (Note:- This is a numerical constraint only)
0.01 <= R <= 99.99 (Note:- This is a numerical constraint only)
-10.00 <= CR <= 10.00 (Note:- This is a numerical constraint only)
Calculation should be done upto 11-digit precision
The Change in Share Value (CSV) and Change in Rating (CR) are dependent as below:
If CSV is Positive, CR can be Positive or Negative.
If CSV is Negative, CR cannot be Positive.
Output related constraints:-
The values of CV, CE and CA are to be rounded to 2 Decimal Places, always to the Ceiling or Upper Value
The range of the calculated values are-
20.00 <= SV' <= 10000.00
0.01 <= R' <= 99.99
All output values should be printed upto 2 decimal places.
The output will be invalid in the following cases-
The input ranges or conditions are not satisfied.
The ranges of calculated values are not satisfied.
The relation between CSV and CR is not satisfied