Newbie here, need help with MULTHREE OF DSA Learning Series

I have made a general formula to calculate sum of the number N : d0 + d1 + (2^(k-2)-1)((d0+d1)%10).

Based on this formula, I have coded the following -

int sum = d0 + d1;
int I = sum % 10;
int otherTermRemainderWhenDividedBy3 = 0;
if(K%2!=0) {
otherTermRemainderWhenDividedBy3 = I%3;
}
if(sum%3==0&&otherTermRemainderWhenDividedBy3==0) {
System.out.println(“YES”);
continue;
}
if(sum%3==1&&otherTermRemainderWhenDividedBy3==2) {
System.out.println(“YES”);
continue;
}
if(sum%3==2&&otherTermRemainderWhenDividedBy3==1) {
System.out.println(“YES”);
continue;
}
System.out.println(“NO”);

But it is coming as WA. Please guide me.