Little Spiridon is a big NBA fan. However, since he's very good with math and not very athletic, he doesn't dream of becoming an NBA superstar, but an NBA analyst instead. Spiro just finished reading the book “Basketball on Paper” by Dean Oliver and is now looking to understand how the Four Factors of winning basketball games work. Will you help little Spiridon - the NBA fan, become big Spiridon – the NBA analyst?
According to Dean Oliver, the four factors of winning basketball games, are Shooting, Turnovers, Rebounding and Free Throws. Each factor can be applied to both the team’s offense, and defense, which basically gives us eight factors, but we will be focusing on the Offense part only, for now.
The Shooting Factor is measured using Effective Field Goal Percentage (eFG%). The formula, by which the eFG% is calculated, is (Field Goals (FG) + 0.5 * 3-Point Field Goals (3P)) / Field Goals Attempted (FGA).
The Turnover Factor is measured using Turnover Percentage (TOV%). The formula for the offensive TOV% is Turnovers (TOV) / (FGA + 0.44 * Free Throw Attempts (FTA) + TOV).
The Rebounding Factor for offense is measured in Offensive Rebounding Percentage (ORB%) and the formula for it is Offensive Rebounds (ORB) / (ORB + Opponent Defensive Rebounds (Opp DRB)).
The Free Throw factor, or the Free Throw Percentage (FT%), is by far the easiest to calculate and the formula for it is Free Throws (FT) / FGA.
Your job is to write a program, which takes certain input parameters, calculates the four offensive factors, rounded to the third digit after the decimal sign, and then prints them on the console. Each factor should always be a positive number.
Input:
The input data should be read from the console. It consists of eight input values, each at a separate line:
-
FG – Field Goals
-
FGA – Field Goal Attempts
-
3P – 3-Point Field Goals
-
TOV – Turnovers
-
ORB – Offensive Rebounds
-
Opp DRB – Opponent Defensive Rebounds
-
FT – Free Throws
-
FTA – Free Throw Attempts
The input data will always be valid and in the format described. There is no need to check it explicitly.
Output:
The output should be printed on the console and it should consist of four strings, each printed on a separate line in the following format:
-
eFG% {factor result}
-
TOV% {factor result}
-
ORB% {factor result}
-
FT% {factor result}
Look at the examples below, to get a better understanding of how the output should be structured.
Constraints
-
All input parameters will be valid integers, in the range [1 ... 3,000,000,000 ].
-
Allowed working time for your program: 0.25 seconds.
-
Allowed memory: 16 MB.