// Arup Guha
// 10/14/2026
// Example class that implements the Addable<T> interface.

import java.util.*;

public class Fraction implements Addable<Fraction> {

	// Usual instance variables for a fraction.
	private int num;
	private int den;
	
	// Constructor.
	public Fraction(int n, int d) {
		num = n;
		den = d;
		int div = gcd(n, d);
		num /= div;
		den /= div;
	}
	
	// So we can reduce fractions.
	public static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a%b);
	}
	
	// Method we are required to implement.
	public Fraction add(Fraction other) {
		int top = this.num*other.den + other.num*this.den;
		int bottom = this.den*other.den;
		return new Fraction(top, bottom);
	}
	
	// So we can print them out easily...
	public String toString() {
		return num+"/"+den;
	}
	
	// Tiny test.
	public static void main(String[] args) {
		Fraction f1 = new Fraction(1, 3);
		Fraction f2 = new Fraction(2, 5);
		System.out.println(f1.add(f2));
	}
}