import java.io.*;
import java.util.*;
class Ideone {
public static void main
(String[] args
) { Scanner scan
= new Scanner
(System.
in); String exp
=scan.
nextLine(); //System.out.println(exp); int campuran=-1,pecahan=-1, desimal=-1;
for(int i=0; i<exp.length(); i++) { //System.out.println(exp.substring(i,i+1));
if(exp.substring(i,i+1).equals(" ")) campuran=i;
if(exp.substring(i,i+1).equals("/")) pecahan=i;
if(exp.substring(i,i+1).equals(".")) desimal=i;
} //System.out.printf("%d %d\n",campuran, pecahan);
if(campuran>-1) {
int x
= Integer.
parseInt(exp.
substring(0,campuran
)); int y
= Integer.
parseInt(exp.
substring(campuran
+1,pecahan
)); int z
= Integer.
parseInt(exp.
substring(pecahan
+1,exp.
length())); int gcd = gcd(y,z);
y/=gcd;
z/=gcd;
double hasil = (double) x+(double)y/z;
System.
out.
println("Desimal: " + hasil
); System.
out.
printf("Pecahan campuran: %d %d/%d\n",x, y, z
); System.
out.
printf("Pecahan: %d/%d\n", x
*z
+y, z
); } else if(pecahan>-1) {
int y
= Integer.
parseInt(exp.
substring(0,pecahan
)); int z
= Integer.
parseInt(exp.
substring(pecahan
+1,exp.
length())); int gcd = gcd(y,z);
y/=gcd;
z/=gcd;
double hasil = (double)y/z;
System.
out.
println("Desimal: " + hasil
); if(y%z==0) {
System.
out.
println("Pecahan campuran: " + hasil
); System.
out.
println("Pecahan: " + hasil
); } else {
if(y
/z
==0) System.
out.
printf("Pecahan campuran: %d/%d\n", y
%z, z
); else System.
out.
printf("Pecahan campuran: %d %d/%d\n", y
/z, y
%z, z
); System.
out.
printf("Pecahan: %d/%d\n", y
%z, z
); }
} else if(desimal>-1) {
double x
= Double.
parseDouble(exp
); int y
= Integer.
parseInt(exp.
substring(0,desimal
)); int z
= Integer.
parseInt(exp.
substring(desimal
+1,exp.
length())); int numerator
= Integer.
parseInt(exp.
substring(0,desimal
)+exp.
substring(desimal
+1,exp.
length())); int denominator
= (int) Math.
pow(10, exp.
length()-desimal
-1); //System.out.println(numerator + " " + denominator); int gcd = gcd(numerator, denominator);
numerator /= gcd;
denominator /= gcd;
System.
out.
println("Desimal: " + x
); if (numerator
/ denominator
== 0) System.
out.
printf("Pecahan campuran: %d/%d\n", numerator, denominator
); else System.
out.
printf("Pecahan campuran: %d %d/%d\n", numerator
/ denominator, numerator
% denominator,denominator
); System.
out.
printf("Pecahan: %d/%d\n", numerator, denominator
); } else {
System.
out.
println("Desimal: 0"); System.
out.
println("Pecahan campuran: 0"); System.
out.
println("Pecahan: 0"); }
}
static int gcd (int a, int b) {
if(b==0) return a;
else return gcd(b, a%b);
}
}
aW1wb3J0IGphdmEuaW8uKjsKaW1wb3J0IGphdmEudXRpbC4qOwpjbGFzcyBJZGVvbmUgewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCVNjYW5uZXIgc2NhbiA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CgkJU3RyaW5nIGV4cD1zY2FuLm5leHRMaW5lKCk7IC8vU3lzdGVtLm91dC5wcmludGxuKGV4cCk7CgkJaW50IGNhbXB1cmFuPS0xLHBlY2FoYW49LTEsIGRlc2ltYWw9LTE7CgkJZm9yKGludCBpPTA7IGk8ZXhwLmxlbmd0aCgpOyBpKyspIHsgLy9TeXN0ZW0ub3V0LnByaW50bG4oZXhwLnN1YnN0cmluZyhpLGkrMSkpOwoJCQlpZihleHAuc3Vic3RyaW5nKGksaSsxKS5lcXVhbHMoIiAiKSkgY2FtcHVyYW49aTsKCQkJaWYoZXhwLnN1YnN0cmluZyhpLGkrMSkuZXF1YWxzKCIvIikpIHBlY2FoYW49aTsKCQkJaWYoZXhwLnN1YnN0cmluZyhpLGkrMSkuZXF1YWxzKCIuIikpIGRlc2ltYWw9aTsKCQl9IC8vU3lzdGVtLm91dC5wcmludGYoIiVkICVkXG4iLGNhbXB1cmFuLCBwZWNhaGFuKTsKCQlpZihjYW1wdXJhbj4tMSkgewoJCQlpbnQgeCA9IEludGVnZXIucGFyc2VJbnQoZXhwLnN1Y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