Hide

Problem G
Solidus Fraction

A fraction written with a solidus (/) can be written “inline”. However, a fraction may also be written with a horizontal line, known as a vinculum. When a vinculum is used, the numerator is written above and the denominator is written below.

Write a program to convert a vinculum fraction to a solidus fraction.

Input

The first line contains the numerator ($n$) and optional whitespace allowing the numerator to be centered or right-aligned. The second line contains only the vinculum, which consists of one or more dashes (-). The third line contains the denominator ($d$) and optional whitespace allowing the denominator to be centered or right-aligned. ($-10^{18} \leq d,n \leq 10^{18}, d \neq 0$)

Output

Write one line of output containing the reduced fraction, only use a solidus if necessary.

Sample Input 1 Sample Output 1
 -3
----
  4
-3/4
Sample Input 2 Sample Output 2
1
---
100
1/100
Sample Input 3 Sample Output 3
 525
-----
  -5
-105
Sample Input 4 Sample Output 4
-1000000
---
1000000
 -1

Please log in to submit a solution to this problem

Log in