Help me in solving LBJ18 problem

My issue

My code

// Update the code below to solve this problem
import java.util.Scanner;

class Codechef
{
	public static void main (String[] args)
	{
		Scanner read = new Scanner(System.in);
		
		int t = read.nextInt();
		for(int i=0; i<t; i++)
		{
    		int X = read.nextInt();
    		int Y = read.nextInt();
    		int Z = read.nextInt();
    		 int numBreaks = X / 3;

            // Calculate total time without breaks
            int totalTimeWithoutBreaks = X * Y;

            // Calculate total break time
            int totalBreakTime = numBreaks * Z;

            // Calculate total time for completing the game
            int totalTime = totalTimeWithoutBreaks + totalBreakTime;

            // Output the result
            System.out.println(totalTime);
		}
	}
}

Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone

Please help me out to fix this wrong answer into right one…

@sahil_2701
like for x is a multiple of 3 u have to subtract 1 from numBreaks because there no point of taking a break after the completion of all levels .

Can u send the code as well.
Actually what you told me I was do that but it will give me again a wrong answer…

@sahil_2701
Here is the code :-
I have added just one condition in your code.
Hope u will get it.
import java.util.Scanner;

class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);

	int t = read.nextInt();
	for(int i=0; i<t; i++)
	{
		int X = read.nextInt();
		int Y = read.nextInt();
		int Z = read.nextInt();
		 int numBreaks = X / 3;
        if(X%3==0)
        {
            numBreaks--;
        }
        // Calculate total time without breaks
        int totalTimeWithoutBreaks = X * Y;

        // Calculate total break time
        int totalBreakTime = numBreaks * Z;

        // Calculate total time for completing the game
        int totalTime = totalTimeWithoutBreaks + totalBreakTime;

        // Output the result
        System.out.println(totalTime);
	}
}

}