and compare the expected result to your printing to see what is wrong in your code.
To avoid having a big gcd you should first simplify the fractions. On the other hand you could make this first calculation by hand to control your result.
Update: I added a small utility so that you can view your result and the expected result.
Run only the first "Sample Tests" with in your code (just before your return):
and compare the expected result to your printing to see what is wrong in your code.
To avoid having a big gcd you should first simplify the fractions. On the other hand you could make this first calculation by hand to control your result.
Update: I added a small utility so that you can view your result and the expected result.