Could you help in finding bug in multiple of 3 in DSA

public static String check(long k, int d0, int d1)
{

   
     long s = (2 * (d0 + d1)) % 10 +
        (4 * (d0 + d1)) % 10 +
        (8 * (d0 + d1)) % 10 +
        (6 * (d0 + d1)) % 10;

    int a = (int)(k - 3) % 4;

    int x = 0;

    switch(a)
    {

        case 0:

            x = 0;
            break;

        case 1:

            x = (2 * (d0 + d1)) % 10;
            break;

        case 2:

            x = (2 * (d0 + d1)) % 10 +
                    (4 * (d0 + d1)) % 10;
            break;

        case 3:

            x = (2 * (d0 + d1)) % 10 +
                    (4 * (d0 + d1)) % 10 +
                    (8 * (d0 + d1)) % 10;

            break;
    }

     long sum = d0 + d1 + ((k - 3) / 4) * s + x;

    if(sum % 3 == 0)
        return "YES";
    return "NO";
}

Refer this post: Editorial for Problems of Codechef-DSA-Learning-Series: 1-Complexity Analysis + Basics Warm Up