Problems
Java Fraction 2
Java Fraction 2
Find the sum of numerator and denominator of a given fraction.
Implement a class Fraction that uses a wrapper class MyLong.
class MyLong // Java
{
private long a; // one private variable
MyLong(long a) // Constructor
public String toString() // Print a variable of type MyLong
public long GetValue() // Return the value of the private variable
};
class Fraction
{
MyLong numerator, denominator; // numerator and denominator
Fraction(String s) // Constructor
public MyLong GetNumerator() // Return numerator of type MyLong
public MyLong GetDenominator() // Return denominator of type MyLong
public MyLong Sum() // Return sum of numerator and denominator in the variable of type MyLong
};
Input data
String in the form a/b (-10^18
≤ a, b ≤ 10^18
).
Output data
Print the sum of a and b.
Examples
Input example #1
3/4
Output example #1
7