public class Fraction {
    int n;
    int d;

    public Fraction(int n, int d) {
        this.n = n;
        this.d = d;
    }

    public Fraction add(Fraction a) {
        int n = this.d * a.n + a.d * this.n;
        int d = this.d * a.d;
        return new Fraction(n,d);
    }

    public Fraction subtract(Fraction a) {
        int n = ; // BLANK_0
        int d = ; // BLANK_1
        return new Fraction(n,d);
    }

    public Fraction multiply(Fraction a) {
        int n = ; // BLANK_2
        int d = ; // BLANK_3
        return new Fraction(n,d);
    }

    public Fraction divide(Fraction a) {
        int n = ; // BLANK_4
        int d = ; // BLANK_5
        return new Fraction(n,d);
    }

    public Fraction reduce() {
        int gcd = gcd(this.n, this.d);
        this.n = ; // BLANK_6
        this.d = ; // BLANK_7
        return this;
    }

    public static int gcd(int a, int b) {
        if (b==0) return a;
        return gcd(b, a % b);
    }
}