Help me in solving LBC18 problem

My issue

Not getting answer

My code

// Update the code below to solve this problem

#include <iostream>
#include <string>
using namespace std;

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y, Z;
  cin>>X>>Y>>Z;
  if (X<=3)
  {
    int game_complete=X*Y; 
    cout<<game_complete<<endl;
    
  }
  else if(X%3==0){
  
  int game_complete=X*Y;
  int brek=X/3;
  int over=game_complete+(brek*Z);
  cout<<over<<endl;
  }
  else
  {
    int g=X*Y;
    int br=X/3;
    int ov=g+br*Z;
    cout<<ov<<endl;
  }
  
  
   }
return 0;
}

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

@pratham_shetty
Just a little correction in the else if part .
is case of X%3==0 we should multiply ((X/3)-1)*Z .
I have corrected in your code . Hope u will get it.

#include <iostream>
#include <string>
using namespace std;

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y, Z;
  cin>>X>>Y>>Z;
  if (X<=3)
  {
    int game_complete=X*Y; 
    cout<<game_complete<<endl;
    
  }
  else if(X%3==0){
  
  int game_complete=X*Y;
  int brek=X/3;
  brek--;
  int over=game_complete+(brek*Z);
  cout<<over<<endl;
  }
  else
  {
    int g=X*Y;
    int br=X/3;
    int ov=g+br*Z;
    cout<<ov<<endl;
  }
  
  
   }
return 0;
}