class Solution {
public int[] solution(int numer1, int denom1, int numer2, int denom2) {
int[] answer = new int[2];
int a = numer1*denom2+numer2*denom1;
int b = denom1*denom2;
if (a==b) {
answer[0]=1;
answer[1]=1;
}
if (a<b) {
for(int i=1;i<=a;i++){
if(a%i==0&&b%i==0) {
answer[0]=a/i;
answer[1]=b/i;
}
}
}
if (a>b) {
for(int i=1;i<=b;i++){
if(a%i==0&&b%i==0) {
answer[0]=a/i;
answer[1]=b/i;
}
}
}
return answer;
}
}