the problem simplify_fraction, written in java