Annoying Chemistry
Tag(s):

## GCD, Math, Mathematics, Number Theory, Number theory

Problem
Editorial
Analytics

You are given a chemical equation of the following format:

$(b1) C_x + (b2) H_y\ -------->\ (b3) C_p H_q$

Your task is to calculate the balancing factor b1, b2, and b3 such that the number of atoms of each of the elements is equal on both sides.

Note: The answer must be in a reduced form.

Input format

The first line consists of four integers x, y, p, and q.

Output format

The output must contain b1, b2, and b3.

Constraints

$1 \le x \le 10^4\\ 1 \le y \le 10^4\\ 1 \le p \le 10^4\\ 1 \le q \le 10^4$

SAMPLE INPUT
2 3 4 5

SAMPLE OUTPUT
6 5 3

Explanation

Given chemical equation is :

C2  +  H3     -------->    C4 H5

The balanced chemical equation is:

6 C2  + 5 H3     -------->    3 C4 H5

Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, C++17, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, Java 14, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, Python 3.8, R(RScript), Racket, Ruby, Rust, Scala, Swift-4.1, Swift, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

March Circuits '20

OTHER PROBLEMS OF THIS CHALLENGE
• Math > Basic Math
• Algorithms > Dynamic Programming
• Algorithms > Graphs
• Math > Linear Algebra
• Data Structures > Arrays