Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.
Problem hidden on 2014-06-23 09:30:15 by Francky

SNGFRAC1 - Adding Two Fractions

Given two fractions, just add them. Too Easy :)

The fractions are represented either as p/q or p such that q >= 1. Now let p1/q1 and p2/q2 be the given fractions, then the sum of the fractions will either be P/Q or P (that allows the fraction to be in irreducible form).

The fraction given as p is equal to p/1.

Input

The first line of input is T, (total no. of test cases). Next T lines contains two space separated fractions.

Output

Print the sum of two fractions (must be in irreducible form) in most appropriate format in each line.

Example

Input:
5
1/2 1/3
2 -1/2
2/4 4/8
-1/7 1/11
-21/7 -31/1

Output:
5/6
3/2
1
-4/77
-34

Constraints

T <= 10000
-109 <= p <= 109
1 <= q <= 109

Irreducible Fraction

The fraction p/q is said to be in irreducible form if greatest common divisor of "p" and "q" is 1.


Added by:AvmnuSng
Date:2014-06-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Abhimanyu Singh
My Problems

hide comments
2014-07-01 17:15:01 Kanish_The_Vista
nice to solve by using C language......
if source limit size is decreased then its might be interesting to solve it......

Last edit: 2014-07-01 17:23:42
2014-06-22 15:26:03 Mitch Schwartz
Did you pull 2 seconds out of a hat?
--edit(Francky)--> I fully agree with Mitch...

Last edit: 2014-06-22 17:15:11
2014-06-22 12:02:55 AvmnuSng
All languages allowed and time limit is increased to 2 secs. So rejudge will be done.
--ans(Francky)--> Fine. Now your are told more than twice that wordings are mathematically incorrect, are you able to correct them ? Please answer that point too.

Last edit: 2014-06-22 08:25:05
2014-06-22 12:02:55 Francky
Problem moved to tutorial as an interesting easy task. All languages should be allowed, and time limit should be increased to allow all languages to get AC with basic IO.
If psetter don't act for that, the problem will be hidden, and another psetter will be allowed to set the task with correct wordings, data, constraints...

Last edit: 2014-06-21 23:27:08
2014-06-22 12:02:55 wisfaq
Adding two fractions and finding the result in lowest terms hardly is interesting, looks like gradeschool work.
What remains is nefarious input/output parsing.
Especially when the time limits are set such that the use of languages that have libraries that do this for you are ruled out.
So I suggest to move it to tutorial.
Saves a lot of discussion

Last edit: 2014-06-21 21:42:31
2014-06-22 12:02:55 Mitch Schwartz
@Abhimanyu Singh: Unfortunately, one of the issues from my perspective is that your responses/actions cause me to doubt whether you understand the issues that are being discussed.

I am a little curious: Did you know at time of problem publication that this problem is trivially solvable in some languages that have built-in support for fractions? E.g., my first Ruby submission, which initially got AC, and then was TLE very shortly afterward upon rejudge.

When I mentioned about restricting languages, it was obviously in reference to languages that have built-in support for fractions. You then made some strange restrictions without giving any explanation. Note that Python and Ruby both have built-in support but are too slow for your time limits (maybe Python can pass with heavy optimisation like what numerix does, but not with a typical approach). Some languages that don't have built-in support are disallowed, and the time limit is still unfair to slower languages in general. It really makes no sense to me.

Even now it seems like maybe a waste of my time to have explained that much. You, as problem setter, are supposed to demonstrate an ability to set good problems and know how things work in advance, as much as possible. And I've agreed also with what Francky wrote, although I wasn't going to enforce any more action on the problem, since I'm not convinced it's a worthwhile use of our time.

Addendum: If you want my honest recommendation for the best way to proceed, it is: (1) move to tutorial, (2) allow all languages, (3) don't change test data, (4) increase time limits to allow my initial Ruby solution to pass with some breathing room (and you should also ensure that Java can pass without special optimisation -- 0.25s is very close to the time it takes for a no-op Java program to run on Pyramid), (5) rejudge all submissions, (6) if you feel capable, clean up the problem statement to be more mathematically precise (maybe introduce a new variable P=|p| , where |x| denotes absolute value of x).

Last edit: 2014-06-21 18:31:35
2014-06-22 12:02:55 Kanish_The_Vista
Finally Accepted

Last edit: 2014-06-21 16:24:51
2014-06-22 12:02:55 alex
@author:hey what is wrong in my submission:11800073
the problem seems to be interesting
2014-06-22 12:02:55 AvmnuSng
That's enough arguing... EB Members must do the needful regarding the problem.
--Francky--> Are you saying we didn't ? We did it, and I can tell you that you are very annoying. I insist in saying that description is mathematically false (although well understandable). And that your problem should have been ready before put in classical (eg : no add test cases). I insist too that you need to solve more problems. Thanks for your comprehension.

Last edit: 2014-06-21 12:02:01
2014-06-22 12:02:55 Francky
@psetter : We very like when a problem is correctly (and fully) set at start, and we're allowing (requiring) changes when some troubles are present.
Here at start all languages were allowed, please explain why there's now such limitations, you should set them all like in original statement.
The wording in description, is mathematically, for me, very very bad.
I think the problem belongs to tutorial.
I recommend you to solve more problems before setting more. Try too to learn more languages.
I fully agree with Mitch when he spoke about incompetence of psetter. Thanks for your comprehension ; try to learn a bit more before creating new tasks.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.