import java.util.*;
import java.io.*;
public class Main {
///////----------------input----------------//////
	static BufferedReader br= new BufferedReader(new
            InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	static StringTokenizer st;
	static byte[] buffer =new byte[10*1024];
	static int index;
    static InputStream input_stream= System.in;
    static int total;

	static String ns() throws IOException
    {
		 StringBuilder sb = new StringBuilder();
         int n = read();
         while (isWhiteSpace(n))
             n = read();
         while (!isWhiteSpace(n)) {
             sb.append((char)n);
             n = read();
         }
         return sb.toString();
    }

	static int read() throws IOException
	{
		if(total<0)
            throw new InputMismatchException();
        if(index>=total) {
            index=0;
            total= input_stream.read(buffer);
            if(total<=0)
                return -1;
        }
        return buffer[index++];
	}
	static int ni() throws IOException
    {
		int integer=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        int neg=1;
        if(n=='-') {
            neg=-1;
            n= read();
        }
        while(!isWhiteSpace(n)) {
            if(n>='0'&&n<='9') {
                integer*=10;
                integer+=n-'0';
                n= read();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }

	static long nl() throws IOException
    {
		long number=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        long neg=1l;
        if(n=='-') {
            neg=-1l;
            n= read();
        }
        while(!isWhiteSpace(n)) {
            if(n>='0'&&n<='9') {
                number*=10l;
                number+=(long)(n-'0');
                n= read();
            }
            else throw new InputMismatchException();
        }
        return neg*number;
    }

	static double nd() throws IOException
    {
		double doub=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        int neg=1;
        if(n=='-') {
            neg=-1;
            n= read();
        }
        while(!isWhiteSpace(n)&&n!='.') {
            if(n>='0'&&n<='9') {
                doub*=10;
                doub+=n-'0';
                n= read();
            }
            else throw new InputMismatchException();
        }

        if(n=='.') {
            n= read();
            double temp=1;
            while(!isWhiteSpace(n)) {
                if(n>='0'&&n<='9') {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n= read();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }

	static String nsl() throws IOException
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
	static boolean isWhiteSpace(int n) {
        if(n==' '|| n=='\n'|| n=='\r'|| n=='\t'|| n==-1)
            return true;
        return false;
    }

	///////-------------output-----------------//////
	static public void p(String str) throws IOException {
        bw.append(str);
    }
	static public void pn(String str) throws IOException {
        p(str);
        bw.append("\n");
    }
	static public void close()throws IOException {
        bw.close();
    }
	static public void flush()throws IOException {
        bw.flush();
    }

	///////----------THE FAST I/O METHODS ENDS HERE -----------/////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////// FOR INPUT LOOP//////////////////////////////
	public static  int[] loopi(int n) throws IOException
	{
		int arr[]=new int[n];
		for(int i=0;i<n;i++)
			arr[i]=ni();

		return arr;
	}
	public static  String[] loops(String[] arr,int n) throws IOException
	{
		for(int i=0;i<n;i++)
			arr[i]=ns();

		return arr;
	}
	public static  long[] loopl(long[] arr,int n) throws IOException
	{
		for(int i=0;i<n;i++)
			arr[i]=ni();

		return arr;
	}
	/////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	static class Node implements Comparable<Node>{
		int h;
		int w;
		Node(int h,int w)
		{
			this.h=h;
			this.w=w;
		}
		public static String toString(Node n)
		{
			return n.h+" "+n.w;
		}
		@Override
		public int compareTo(Node n)
		{

				return this.h-n.h;
		}

	}

	static boolean al[]=new boolean[1100000];
	  public static void prime()
	  {
	    int n=1000000;

	    for(int i=2;i*i<=n;i++)
	    {
	      if(!al[i]){
	      for(int j=i*2;j<=n;j+=i)
	      {
	        al[j]=true;
	      }

	      }
	    }
	  }
	  public static int count=0;
	 static boolean com[]=new boolean[120000];

	  public static void main(String args[]) throws IOException {
		int t=ni();
		while(t-->0)
		{
			long x=nl(),y=nl(),k=nl();
			long count=0;
			long temp=k+(y*k);
			long ans=0;

			long val=(temp-x)/(x-1);

			if(((temp-x)%(x-1))==0l)
				pn(val+k+1+"");
			else
				pn(val+2+k+"");

		}
		flush();
}
	  }


import java.util.*;
import java.io.*;
public class Main {
///////----------------input----------------//////
	static BufferedReader br= new BufferedReader(new
            InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	static StringTokenizer st;
	static byte[] buffer =new byte[10*1024];
	static int index;
    static InputStream input_stream= System.in;
    static int total;

	static String ns() throws IOException
    {
		 StringBuilder sb = new StringBuilder();
         int n = read();
         while (isWhiteSpace(n))
             n = read();
         while (!isWhiteSpace(n)) {
             sb.append((char)n);
             n = read();
         }
         return sb.toString();
    }

	static int read() throws IOException
	{
		if(total<0)
            throw new InputMismatchException();
        if(index>=total) {
            index=0;
            total= input_stream.read(buffer);
            if(total<=0)
                return -1;
        }
        return buffer[index++];
	}
	static int ni() throws IOException
    {
		int integer=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        int neg=1;
        if(n=='-') {
            neg=-1;
            n= read();
        }
        while(!isWhiteSpace(n)) {
            if(n>='0'&&n<='9') {
                integer*=10;
                integer+=n-'0';
                n= read();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }

	static long nl() throws IOException
    {
		long number=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        long neg=1l;
        if(n=='-') {
            neg=-1l;
            n= read();
        }
        while(!isWhiteSpace(n)) {
            if(n>='0'&&n<='9') {
                number*=10l;
                number+=(long)(n-'0');
                n= read();
            }
            else throw new InputMismatchException();
        }
        return neg*number;
    }

	static double nd() throws IOException
    {
		double doub=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        int neg=1;
        if(n=='-') {
            neg=-1;
            n= read();
        }
        while(!isWhiteSpace(n)&&n!='.') {
            if(n>='0'&&n<='9') {
                doub*=10;
                doub+=n-'0';
                n= read();
            }
            else throw new InputMismatchException();
        }

        if(n=='.') {
            n= read();
            double temp=1;
            while(!isWhiteSpace(n)) {
                if(n>='0'&&n<='9') {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n= read();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }

	static String nsl() throws IOException
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
	static boolean isWhiteSpace(int n) {
        if(n==' '|| n=='\n'|| n=='\r'|| n=='\t'|| n==-1)
            return true;
        return false;
    }

	///////-------------output-----------------//////
	static public void p(String str) throws IOException {
        bw.append(str);
    }
	static public void pn(String str) throws IOException {
        p(str);
        bw.append("\n");
    }
	static public void close()throws IOException {
        bw.close();
    }
	static public void flush()throws IOException {
        bw.flush();
    }

	///////----------THE FAST I/O METHODS ENDS HERE -----------/////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////// FOR INPUT LOOP//////////////////////////////
	public static  int[] loopi(int n) throws IOException
	{
		int arr[]=new int[n];
		for(int i=0;i<n;i++)
			arr[i]=ni();

		return arr;
	}
	public static  String[] loops(String[] arr,int n) throws IOException
	{
		for(int i=0;i<n;i++)
			arr[i]=ns();

		return arr;
	}
	public static  long[] loopl(long[] arr,int n) throws IOException
	{
		for(int i=0;i<n;i++)
			arr[i]=ni();

		return arr;
	}
	/////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	static class Node implements Comparable<Node>{
		int h;
		int w;
		Node(int h,int w)
		{
			this.h=h;
			this.w=w;
		}
		public static String toString(Node n)
		{
			return n.h+" "+n.w;
		}
		@Override
		public int compareTo(Node n)
		{

				return this.h-n.h;
		}

	}

	static boolean al[]=new boolean[1100000];
	  public static void prime()
	  {
	    int n=1000000;

	    for(int i=2;i*i<=n;i++)
	    {
	      if(!al[i]){
	      for(int j=i*2;j<=n;j+=i)
	      {
	        al[j]=true;
	      }

	      }
	    }
	  }
	  public static int count=0;
	 static boolean com[]=new boolean[120000];

	  public static void main(String args[]) throws IOException {
		int t=ni();
		while(t-->0)
		{
			long x=nl(),y=nl(),k=nl();
			long count=0;
			long temp=k+(y*k);
			long ans=0;

			long val=(temp-x)/(x-1);

			if(((temp-x)%(x-1))+x>x)
				pn(val+k+2+"");
			else
				pn(val+1+k+"");

		}
		flush();
}
	  }


import java.util.*;
import java.io.*;
public class Main {
///////----------------input----------------//////
	static BufferedReader br= new BufferedReader(new
            InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	static StringTokenizer st;
	static byte[] buffer =new byte[10*1024];
	static int index;
    static InputStream input_stream= System.in;
    static int total;

	static String ns() throws IOException
    {
		 StringBuilder sb = new StringBuilder();
         int n = read();
         while (isWhiteSpace(n))
             n = read();
         while (!isWhiteSpace(n)) {
             sb.append((char)n);
             n = read();
         }
         return sb.toString();
    }

	static int read() throws IOException
	{
		if(total<0)
            throw new InputMismatchException();
        if(index>=total) {
            index=0;
            total= input_stream.read(buffer);
            if(total<=0)
                return -1;
        }
        return buffer[index++];
	}
	static int ni() throws IOException
    {
		int integer=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        int neg=1;
        if(n=='-') {
            neg=-1;
            n= read();
        }
        while(!isWhiteSpace(n)) {
            if(n>='0'&&n<='9') {
                integer*=10;
                integer+=n-'0';
                n= read();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }

	static long nl() throws IOException
    {
		long number=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        long neg=1l;
        if(n=='-') {
            neg=-1l;
            n= read();
        }
        while(!isWhiteSpace(n)) {
            if(n>='0'&&n<='9') {
                number*=10l;
                number+=(long)(n-'0');
                n= read();
            }
            else throw new InputMismatchException();
        }
        return neg*number;
    }

	static double nd() throws IOException
    {
		double doub=0;
        int n= read();
        while(isWhiteSpace(n))
            n= read();
        int neg=1;
        if(n=='-') {
            neg=-1;
            n= read();
        }
        while(!isWhiteSpace(n)&&n!='.') {
            if(n>='0'&&n<='9') {
                doub*=10;
                doub+=n-'0';
                n= read();
            }
            else throw new InputMismatchException();
        }

        if(n=='.') {
            n= read();
            double temp=1;
            while(!isWhiteSpace(n)) {
                if(n>='0'&&n<='9') {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n= read();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }

	static String nsl() throws IOException
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
	static boolean isWhiteSpace(int n) {
        if(n==' '|| n=='\n'|| n=='\r'|| n=='\t'|| n==-1)
            return true;
        return false;
    }

	///////-------------output-----------------//////
	static public void p(String str) throws IOException {
        bw.append(str);
    }
	static public void pn(String str) throws IOException {
        p(str);
        bw.append("\n");
    }
	static public void close()throws IOException {
        bw.close();
    }
	static public void flush()throws IOException {
        bw.flush();
    }

	///////----------THE FAST I/O METHODS ENDS HERE -----------/////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////// FOR INPUT LOOP//////////////////////////////
	public static  int[] loopi(int n) throws IOException
	{
		int arr[]=new int[n];
		for(int i=0;i<n;i++)
			arr[i]=ni();

		return arr;
	}
	public static  String[] loops(String[] arr,int n) throws IOException
	{
		for(int i=0;i<n;i++)
			arr[i]=ns();

		return arr;
	}
	public static  long[] loopl(long[] arr,int n) throws IOException
	{
		for(int i=0;i<n;i++)
			arr[i]=ni();

		return arr;
	}
	/////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	static class Node implements Comparable<Node>{
		int h;
		int w;
		Node(int h,int w)
		{
			this.h=h;
			this.w=w;
		}
		public static String toString(Node n)
		{
			return n.h+" "+n.w;
		}
		@Override
		public int compareTo(Node n)
		{

				return this.h-n.h;
		}

	}

	static boolean al[]=new boolean[1100000];
	  public static void prime()
	  {
	    int n=1000000;

	    for(int i=2;i*i<=n;i++)
	    {
	      if(!al[i]){
	      for(int j=i*2;j<=n;j+=i)
	      {
	        al[j]=true;
	      }

	      }
	    }
	  }
	  public static int count=0;
	 static boolean com[]=new boolean[120000];

	  public static void main(String args[]) throws IOException {
		int t=ni();
		while(t-->0)
		{
			long x=nl(),y=nl(),k=nl();
			long count=0;
			long temp=k+(y*k);
			long ans=0;

			long val=(temp-x)/(x-1);

			if((temp-x)%(x-1)==0)
				pn(val+k+1+"");
			else
				pn(val+2+k+"");

		}
		flush();
}
	  }


import java.util.*;

public class k {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int tc = in.nextInt();
		for ( ; tc > 0; tc--) {
			long x = in.nextLong();
			long y = in.nextLong();
			long t = in.nextLong();
			long u = t * (y + 1) - 1;
			long d = x - 1;
			long ans = (u + d - 1) / d + t;
			System.out.println(ans);
		}
	}
}


import java.io.IOException;
import java.util.Scanner;

public class A1418 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        while (t-->0){
            long x= scan.nextLong();
            long y= scan.nextLong();
            long k= scan.nextLong();

            long ans = k + ((y*k +k+ x-3)/(x-1));
            System.out.println(ans);
        }
    }
}


import java.io.IOException;
import java.util.Scanner;

public class A1418 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        while (t-->0){
            long x= scan.nextLong();
            long y= scan.nextLong();
            long k= scan.nextLong();

            long ans = k + (long)Math.ceil((k+ k*y -1)/(double)(x-1));
            System.out.println(ans);
        }
    }
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static java.util.stream.IntStream.of;

public final class Code2 {

    static FastIO2 rd = new FastIO2();
    static Scanner sc = new Scanner(System.in);
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static Random rand = new Random();

    public static void main(String[] args) {
        try {

            // FileReader fr=new FileReader("E:\\Github\\Competition\\inp.txt");

            int t=nxti();
            while(t-->0){
                int inp[] = nxtira();
                long x=inp[0];
                long y=inp[1];
                long k=inp[2];

                double f = (k*(x+y)-1.0) / (x-1.0);

                if((k*(x+y)-1) % (x-1)!=0)f++;

                prln((long)f);

            }

            // int i;
            // while((i=fr.read())!=-1)
            //     System.out.print((char)i);
            // fr.close();

            flush();
            close();

        } catch (Exception e) {rd.println(e);}

    }

    public static boolean check(int[] a,int sum) {

        int tempsum=0;
        for (int i = 0; i < a.length-1; i++) {
            tempsum+=a[i];
            if(tempsum==(sum/2)) return true;
        }
        return false ;
    }

    public static void swap(int[] a,int i) {

        int temp=i;

    }

    static void dbgra(int[] a) {prln(Arrays.toString(a));}
    static void dbgra(long[] a) {prln(Arrays.toString(a));}
    static void dbgra(String[] a) {prln(Arrays.toString(a));}
    static void dbgra(char[] a) {prln(Arrays.toString(a));}
    static void dbgra(Integer[] a) {prln(Arrays.toString(a));}
    static void dbgra(Set<Integer> a) {prln(a.toString());}
    static void dbgral(ArrayList<Integer> al) {prln(al.toString());}
    static void dbgrall(ArrayList<Long> al) {prln(al.toString());}
    static void dbgrald(ArrayList<Double> al) {prln(al.toString());}
    static void dbgrals(ArrayList<String> al) {prln(al.toString());}

    public static int[] sort(int[] arr) {
        if (arr.length <= 20) {
            // QUICK sort

        } else {
            // MERGE sort

        }

        return arr;
    }

    // Global variables
    static int count = 0, temp = 0, max = 0, min = 0, sum = 0, fact = 1, prod = 1, n,m,k;

    static int size = 0;
    static char c, ch;
    static String str = new String();
    static String str1 = new String();
    static String[] ras = new String[size];
    static int[] rai = new int[size];
    static int[] arr = new int[size];
    static long[] ral = new long[size];
    static ArrayList<String> rals = new ArrayList<>();
    static ArrayList<Integer> rali = new ArrayList<>();
    static ArrayList<Integer> al = new ArrayList<>();
    static ArrayList<Integer> al1 = new ArrayList<>();
    static ArrayList<Integer> al2 = new ArrayList<>();
    static ArrayList<Long> rall = new ArrayList<>();
    static ArrayList<Double> rald = new ArrayList<>();

    // references
    // IBIG = 1e9 + 7
    // IRAND ~= 3e8
    // IMAX ~= 2e10
    // LMAX ~= 9e18
    // constants
    static final int IBIG = 1000000007;
    static final int IRAND = 327859546;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;

    // math util
    static int min(int a,int b){return a<b?a:b;}
    static long min(long a,long b){return a<b?a:b;}
    static int max(int a,int b){return a>b?a:b;}
    static long max(long a,long b){return a>b?a:b;}
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int min(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static long min(long a, long b, long c) {return min(a, min(b, c));}
    static long min(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static int max(int a, int b, int c) {return max(a, max(b, c));}
    static int max(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static long max(long a, long b, long c) {return max(a, max(b, c));}
    static long max(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static int max(ArrayList<Integer> al) {return Collections.max(al);}
    static int min(ArrayList<Integer> al) {return Collections.min(al);}
    static int count(int n){return floori(Math.log10(n))+1;}
    static int count(long n){return (int)(Math.floor(Math.log10(n))+1);}
    static int count(String s , char c){int count=0;for (int i = 0; i < s.length(); i++) {if(s.charAt(i)==c)count++;}return count;}
    static int count(char[] s , char c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(int[] s , int c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(long[] s , long c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(double[] s , double c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(List<String> s , String c){int count=0;for (int i = 0; i < s.size(); i++) {if(s.get(i)==c)count++;}return count;}
    static int[] countAll(String s){int[] alpha = new int[26];for (int i = 0; i < s.length(); i++) {alpha[(int)s.charAt(i)-97]++;}return alpha;}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int sqrt(int n){return (int)Math.sqrt(n);}
    static long sqrt(long n){return (long)Math.sqrt(n);}
    static double sqrt(double n){return Math.sqrt(n);}
    static int floori(double d) {return (int)Math.floor(d);}
    static int ceili(double d) {return (int)Math.ceil(d);}
    static long floorl(double d) {return (long)Math.floor(d);}
    static long ceill(double d) {return (long)Math.ceil(d);}
    static long lcm(long a, long b) {return (a * b) / gcd(a, b);}
    static long gcd(long a, long b) {if (a == 0)return b; return gcd(b % a, a);}
    static int lcm(int a, int b) {return (a * b) / gcd(a, b);}
    static int gcd(int a, int b) {if (a == 0)return b; return gcd(b % a, a);}
    static boolean prime(int n) {for (int i = 2; i <= sqrt(n); i++) {if(n%i==0)return false;}return true ;}
    static int randInt(int min, int max) {return rand.nextInt(max - min + 1) + min;}

    // array util
    static boolean vowel(char c) {if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y')return true; else return false ;}
    static void reverse(int[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(long[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(double[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(char[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static <T> void reverse(T[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {T swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void shuffle(int[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(long[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(double[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(char[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); char swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static <T> void shuffle(T[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); T swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void rsort(int[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(long[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(double[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(char[] a) {shuffle(a); Arrays.sort(a);}
    static <T> void rsort(T[] a) {shuffle(a); Arrays.sort(a);}
    static String leftPad(String str , int n , String s){String temp="";for (int i = 0; i < n-str.length(); i++) {temp+=s;} temp+=str; return temp;}
    static String rightPad(String str , int n , String s){for (int i = 0; i < n-str.length(); i++) {str+=s;}return str;}

    //input
    static int nxti() throws NumberFormatException, IOException {return rd.nextInt();}
    static long nxtl() throws NumberFormatException, IOException {return rd.nextLong();}
    static double nxtd() throws NumberFormatException, IOException {return rd.nextDouble();}
    static char nxtc() throws NumberFormatException, IOException {return rd.nextChar();}
    static String nxt() throws IOException {return rd.next();}
    static int[] nxtira() throws NumberFormatException, IOException {return rd.nextIntArray();}
    // static int[][] nxtira(int r, int c){return rd.nextInt2DArray(r,c);}
    // static long[] nxtlra(int size){return rd.nextLongArray(size);}
    // static long[][] nxtlra(int r, int c){return rd.nextLong2DArray(r,c);}
    // static char[] nxtcra(){return rd.next().toCharArray();}
    // static String[] nxtsra(int size){return rd.nextStringArray(size);}

    // // output
    static void pr(int i) {rd.print(i);}
    static void prln(int i) {rd.println(i);}
    static void pr(long l) {rd.print(l);}
    static void prln(long l) {rd.println(l);}
    static void pr(double d) {rd.print(d);}
    static void prln(double d) {rd.println(d);}
    static void pr(char c) {rd.print(c);}
    static void prln(char c) {rd.println(c);}

    static void prln() {rd.println();}
    static void prln(char[] c) {rd.println(c);}
    static void pr(String s) {rd.print(s);}
    static void prln(String s) {rd.println(s);}
    static void pr(Object o) {System.out.print(o);}
    static void prln(Object o) {System.out.println(o);}
    static void pry() {rd.println("yes");}
    static void prYes() {rd.println("Yes");}
    static void prY() {rd.println("YES");}
    static void prn() {rd.println("no");}
    static void prNo() {rd.println("No");}
    static void prN() {rd.println("NO");}
    static void pryn(boolean b) {rd.println(b ? "yes" : "no");};
    static void prYesNo(boolean b) {System.out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {System.out.println(b ? "YES" : "NO");}
    static void pr(int[] a){rd.print(a);}
    static void prln(int[] a){rd.println(a);}
    static void pr(long[] a){rd.print(a);}
    static void prln(long[] a){rd.println(a);}
    static void pr(double[] a){rd.print(a);}
    static void prln(double[] a){rd.println(a);}
    static void prln(char[][] a){rd.println(a);}
    static void prln(boolean[][] a){rd.println(a);}
    // static void pr(String[] a){rd.print(a);}
    // static void prln(String[] a){rd.println(a);}
    // // static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; rd.print(iter.next()), rd.print(' '), ++i); rd.println(iter.next());}
    static void flush() {rd.flush();}
    static void close() {rd.close();}
}

class FastIO2{

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static String next() throws IOException {
        String s = br.readLine();
        return s;
    }

    public static int nextInt() throws NumberFormatException, IOException {
        int n = Integer.parseInt(next());
        return n;
    }

    public static long nextLong() throws NumberFormatException, IOException {
        long n = Long.parseLong(next());
        return n;
    }

    public static double nextDouble() throws NumberFormatException, IOException {
        double n = Double.parseDouble(next());
        return n;
    }

    public static char nextChar() throws NumberFormatException, IOException {
        String s = next();
        char c = s.charAt(0);
        return c;
    }

    public static int[] nextIntArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i]=Integer.parseInt(s[i]);
        }
        return a;
    }
    public static long[] nextLongArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i]=Long.parseLong(s[i]);
        }
        return a;
    }
    public static double[] nextDoubleArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        double[] a = new double[size];
        for (int i = 0; i < size; i++) {
            a[i]=Double.parseDouble(s[i]);
        }
        return a;
    }

    public void print(int n){out.print(n);}
    public void print(long n){out.print(n);}
    public void print(float n){out.print(n);}
    public void print(double n){out.print(n);}
    public void print(char n){out.print(n);}
    public void print(String n){out.print(n);}
    public void print(boolean n){out.print(n);}
    public void print(Object n){out.print(n);}
    public void print(char[] c){out.print(c);}
    public void print(int[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(long[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(double[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(String[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }

    public void println(){out.println();}
    public void println(int s){out.println(s);}
    public void println(long s){out.println(s);}
    public void println(float s){out.println(s);}
    public void println(double s){out.println(s);}
    public void println(char s){out.println(s);}
    public void println(String s){out.println(s);}
    public void println(boolean s){out.println(s);}
    public void println(Object s){out.println(s);}
    public void println(char[] s){out.println(s);}
    public void println(int[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(long[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(double[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(String[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(int[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(long[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(double[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(char[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(boolean[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }

    public void flush(){out.flush();};
    public void close(){out.close();};
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static java.util.stream.IntStream.of;

public final class Code2 {

    static FastIO2 rd = new FastIO2();
    static Scanner sc = new Scanner(System.in);
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static Random rand = new Random();

    public static void main(String[] args) {
        try {

            // FileReader fr=new FileReader("E:\\Github\\Competition\\inp.txt");

            int t=nxti();
            while(t-->0){
                int inp[] = nxtira();
                int x=inp[0];
                int y=inp[1];
                int k=inp[2];

                double f = ((k*(y+1.0))-1.0)/(x-1.0);

                if(f%1==0)prln((long)(f+k));
                else prln((long)(f+k+1));

            }

            // int i;
            // while((i=fr.read())!=-1)
            //     System.out.print((char)i);
            // fr.close();

            flush();
            close();

        } catch (Exception e) {rd.println(e);}

    }

    public static boolean check(int[] a,int sum) {

        int tempsum=0;
        for (int i = 0; i < a.length-1; i++) {
            tempsum+=a[i];
            if(tempsum==(sum/2)) return true;
        }
        return false ;
    }

    public static void swap(int[] a,int i) {

        int temp=i;

    }

    static void dbgra(int[] a) {prln(Arrays.toString(a));}
    static void dbgra(long[] a) {prln(Arrays.toString(a));}
    static void dbgra(String[] a) {prln(Arrays.toString(a));}
    static void dbgra(char[] a) {prln(Arrays.toString(a));}
    static void dbgra(Integer[] a) {prln(Arrays.toString(a));}
    static void dbgra(Set<Integer> a) {prln(a.toString());}
    static void dbgral(ArrayList<Integer> al) {prln(al.toString());}
    static void dbgrall(ArrayList<Long> al) {prln(al.toString());}
    static void dbgrald(ArrayList<Double> al) {prln(al.toString());}
    static void dbgrals(ArrayList<String> al) {prln(al.toString());}

    public static int[] sort(int[] arr) {
        if (arr.length <= 20) {
            // QUICK sort

        } else {
            // MERGE sort

        }

        return arr;
    }

    // Global variables
    static int count = 0, temp = 0, max = 0, min = 0, sum = 0, fact = 1, prod = 1, n,m,k;

    static int size = 0;
    static char c, ch;
    static String str = new String();
    static String str1 = new String();
    static String[] ras = new String[size];
    static int[] rai = new int[size];
    static int[] arr = new int[size];
    static long[] ral = new long[size];
    static ArrayList<String> rals = new ArrayList<>();
    static ArrayList<Integer> rali = new ArrayList<>();
    static ArrayList<Integer> al = new ArrayList<>();
    static ArrayList<Integer> al1 = new ArrayList<>();
    static ArrayList<Integer> al2 = new ArrayList<>();
    static ArrayList<Long> rall = new ArrayList<>();
    static ArrayList<Double> rald = new ArrayList<>();

    // references
    // IBIG = 1e9 + 7
    // IRAND ~= 3e8
    // IMAX ~= 2e10
    // LMAX ~= 9e18
    // constants
    static final int IBIG = 1000000007;
    static final int IRAND = 327859546;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;

    // math util
    static int min(int a,int b){return a<b?a:b;}
    static long min(long a,long b){return a<b?a:b;}
    static int max(int a,int b){return a>b?a:b;}
    static long max(long a,long b){return a>b?a:b;}
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int min(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static long min(long a, long b, long c) {return min(a, min(b, c));}
    static long min(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static int max(int a, int b, int c) {return max(a, max(b, c));}
    static int max(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static long max(long a, long b, long c) {return max(a, max(b, c));}
    static long max(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static int max(ArrayList<Integer> al) {return Collections.max(al);}
    static int min(ArrayList<Integer> al) {return Collections.min(al);}
    static int count(int n){return floori(Math.log10(n))+1;}
    static int count(long n){return (int)(Math.floor(Math.log10(n))+1);}
    static int count(String s , char c){int count=0;for (int i = 0; i < s.length(); i++) {if(s.charAt(i)==c)count++;}return count;}
    static int count(char[] s , char c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(int[] s , int c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(long[] s , long c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(double[] s , double c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(List<String> s , String c){int count=0;for (int i = 0; i < s.size(); i++) {if(s.get(i)==c)count++;}return count;}
    static int[] countAll(String s){int[] alpha = new int[26];for (int i = 0; i < s.length(); i++) {alpha[(int)s.charAt(i)-97]++;}return alpha;}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int sqrt(int n){return (int)Math.sqrt(n);}
    static long sqrt(long n){return (long)Math.sqrt(n);}
    static double sqrt(double n){return Math.sqrt(n);}
    static int floori(double d) {return (int)Math.floor(d);}
    static int ceili(double d) {return (int)Math.ceil(d);}
    static long floorl(double d) {return (long)Math.floor(d);}
    static long ceill(double d) {return (long)Math.ceil(d);}
    static long lcm(long a, long b) {return (a * b) / gcd(a, b);}
    static long gcd(long a, long b) {if (a == 0)return b; return gcd(b % a, a);}
    static int lcm(int a, int b) {return (a * b) / gcd(a, b);}
    static int gcd(int a, int b) {if (a == 0)return b; return gcd(b % a, a);}
    static boolean prime(int n) {for (int i = 2; i <= sqrt(n); i++) {if(n%i==0)return false;}return true ;}
    static int randInt(int min, int max) {return rand.nextInt(max - min + 1) + min;}

    // array util
    static boolean vowel(char c) {if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y')return true; else return false ;}
    static void reverse(int[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(long[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(double[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(char[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static <T> void reverse(T[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {T swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void shuffle(int[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(long[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(double[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(char[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); char swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static <T> void shuffle(T[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); T swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void rsort(int[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(long[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(double[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(char[] a) {shuffle(a); Arrays.sort(a);}
    static <T> void rsort(T[] a) {shuffle(a); Arrays.sort(a);}
    static String leftPad(String str , int n , String s){String temp="";for (int i = 0; i < n-str.length(); i++) {temp+=s;} temp+=str; return temp;}
    static String rightPad(String str , int n , String s){for (int i = 0; i < n-str.length(); i++) {str+=s;}return str;}

    //input
    static int nxti() throws NumberFormatException, IOException {return rd.nextInt();}
    static long nxtl() throws NumberFormatException, IOException {return rd.nextLong();}
    static double nxtd() throws NumberFormatException, IOException {return rd.nextDouble();}
    static char nxtc() throws NumberFormatException, IOException {return rd.nextChar();}
    static String nxt() throws IOException {return rd.next();}
    static int[] nxtira() throws NumberFormatException, IOException {return rd.nextIntArray();}
    // static int[][] nxtira(int r, int c){return rd.nextInt2DArray(r,c);}
    // static long[] nxtlra(int size){return rd.nextLongArray(size);}
    // static long[][] nxtlra(int r, int c){return rd.nextLong2DArray(r,c);}
    // static char[] nxtcra(){return rd.next().toCharArray();}
    // static String[] nxtsra(int size){return rd.nextStringArray(size);}

    // // output
    static void pr(int i) {rd.print(i);}
    static void prln(int i) {rd.println(i);}
    static void pr(long l) {rd.print(l);}
    static void prln(long l) {rd.println(l);}
    static void pr(double d) {rd.print(d);}
    static void prln(double d) {rd.println(d);}
    static void pr(char c) {rd.print(c);}
    static void prln(char c) {rd.println(c);}

    static void prln() {rd.println();}
    static void prln(char[] c) {rd.println(c);}
    static void pr(String s) {rd.print(s);}
    static void prln(String s) {rd.println(s);}
    static void pr(Object o) {System.out.print(o);}
    static void prln(Object o) {System.out.println(o);}
    static void pry() {rd.println("yes");}
    static void prYes() {rd.println("Yes");}
    static void prY() {rd.println("YES");}
    static void prn() {rd.println("no");}
    static void prNo() {rd.println("No");}
    static void prN() {rd.println("NO");}
    static void pryn(boolean b) {rd.println(b ? "yes" : "no");};
    static void prYesNo(boolean b) {System.out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {System.out.println(b ? "YES" : "NO");}
    static void pr(int[] a){rd.print(a);}
    static void prln(int[] a){rd.println(a);}
    static void pr(long[] a){rd.print(a);}
    static void prln(long[] a){rd.println(a);}
    static void pr(double[] a){rd.print(a);}
    static void prln(double[] a){rd.println(a);}
    static void prln(char[][] a){rd.println(a);}
    static void prln(boolean[][] a){rd.println(a);}
    // static void pr(String[] a){rd.print(a);}
    // static void prln(String[] a){rd.println(a);}
    // // static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; rd.print(iter.next()), rd.print(' '), ++i); rd.println(iter.next());}
    static void flush() {rd.flush();}
    static void close() {rd.close();}
}

class FastIO2{

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static String next() throws IOException {
        String s = br.readLine();
        return s;
    }

    public static int nextInt() throws NumberFormatException, IOException {
        int n = Integer.parseInt(next());
        return n;
    }

    public static long nextLong() throws NumberFormatException, IOException {
        long n = Long.parseLong(next());
        return n;
    }

    public static double nextDouble() throws NumberFormatException, IOException {
        double n = Double.parseDouble(next());
        return n;
    }

    public static char nextChar() throws NumberFormatException, IOException {
        String s = next();
        char c = s.charAt(0);
        return c;
    }

    public static int[] nextIntArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i]=Integer.parseInt(s[i]);
        }
        return a;
    }
    public static long[] nextLongArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i]=Long.parseLong(s[i]);
        }
        return a;
    }
    public static double[] nextDoubleArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        double[] a = new double[size];
        for (int i = 0; i < size; i++) {
            a[i]=Double.parseDouble(s[i]);
        }
        return a;
    }

    public void print(int n){out.print(n);}
    public void print(long n){out.print(n);}
    public void print(float n){out.print(n);}
    public void print(double n){out.print(n);}
    public void print(char n){out.print(n);}
    public void print(String n){out.print(n);}
    public void print(boolean n){out.print(n);}
    public void print(Object n){out.print(n);}
    public void print(char[] c){out.print(c);}
    public void print(int[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(long[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(double[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(String[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }

    public void println(){out.println();}
    public void println(int s){out.println(s);}
    public void println(long s){out.println(s);}
    public void println(float s){out.println(s);}
    public void println(double s){out.println(s);}
    public void println(char s){out.println(s);}
    public void println(String s){out.println(s);}
    public void println(boolean s){out.println(s);}
    public void println(Object s){out.println(s);}
    public void println(char[] s){out.println(s);}
    public void println(int[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(long[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(double[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(String[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(int[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(long[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(double[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(char[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(boolean[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }

    public void flush(){out.flush();};
    public void close(){out.close();};
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static java.util.stream.IntStream.of;

public final class Code2 {

    static FastIO2 rd = new FastIO2();
    static Scanner sc = new Scanner(System.in);
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static Random rand = new Random();

    public static void main(String[] args) {
        try {

            // FileReader fr=new FileReader("E:\\Github\\Competition\\inp.txt");

            int t=nxti();
            while(t-->0){
                int inp[] = nxtira();
                long x=inp[0];
                long y=inp[1];
                long k=inp[2];

                long sticks = (k*(y+1)-1);

                long ans = sticks/(x-1);

                if(sticks%(x-1)!=0)ans++;

                prln(ans+k);

            }

            // int i;
            // while((i=fr.read())!=-1)
            //     System.out.print((char)i);
            // fr.close();

            flush();
            close();

        } catch (Exception e) {rd.println(e);}

    }

    public static boolean check(int[] a,int sum) {

        int tempsum=0;
        for (int i = 0; i < a.length-1; i++) {
            tempsum+=a[i];
            if(tempsum==(sum/2)) return true;
        }
        return false ;
    }

    public static void swap(int[] a,int i) {

        int temp=i;

    }

    static void dbgra(int[] a) {prln(Arrays.toString(a));}
    static void dbgra(long[] a) {prln(Arrays.toString(a));}
    static void dbgra(String[] a) {prln(Arrays.toString(a));}
    static void dbgra(char[] a) {prln(Arrays.toString(a));}
    static void dbgra(Integer[] a) {prln(Arrays.toString(a));}
    static void dbgra(Set<Integer> a) {prln(a.toString());}
    static void dbgral(ArrayList<Integer> al) {prln(al.toString());}
    static void dbgrall(ArrayList<Long> al) {prln(al.toString());}
    static void dbgrald(ArrayList<Double> al) {prln(al.toString());}
    static void dbgrals(ArrayList<String> al) {prln(al.toString());}

    public static int[] sort(int[] arr) {
        if (arr.length <= 20) {
            // QUICK sort

        } else {
            // MERGE sort

        }

        return arr;
    }

    // Global variables
    static int count = 0, temp = 0, max = 0, min = 0, sum = 0, fact = 1, prod = 1, n,m,k;

    static int size = 0;
    static char c, ch;
    static String str = new String();
    static String str1 = new String();
    static String[] ras = new String[size];
    static int[] rai = new int[size];
    static int[] arr = new int[size];
    static long[] ral = new long[size];
    static ArrayList<String> rals = new ArrayList<>();
    static ArrayList<Integer> rali = new ArrayList<>();
    static ArrayList<Integer> al = new ArrayList<>();
    static ArrayList<Integer> al1 = new ArrayList<>();
    static ArrayList<Integer> al2 = new ArrayList<>();
    static ArrayList<Long> rall = new ArrayList<>();
    static ArrayList<Double> rald = new ArrayList<>();

    // references
    // IBIG = 1e9 + 7
    // IRAND ~= 3e8
    // IMAX ~= 2e10
    // LMAX ~= 9e18
    // constants
    static final int IBIG = 1000000007;
    static final int IRAND = 327859546;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;

    // math util
    static int min(int a,int b){return a<b?a:b;}
    static long min(long a,long b){return a<b?a:b;}
    static int max(int a,int b){return a>b?a:b;}
    static long max(long a,long b){return a>b?a:b;}
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int min(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static long min(long a, long b, long c) {return min(a, min(b, c));}
    static long min(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static int max(int a, int b, int c) {return max(a, max(b, c));}
    static int max(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static long max(long a, long b, long c) {return max(a, max(b, c));}
    static long max(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static int max(ArrayList<Integer> al) {return Collections.max(al);}
    static int min(ArrayList<Integer> al) {return Collections.min(al);}
    static int count(int n){return floori(Math.log10(n))+1;}
    static int count(long n){return (int)(Math.floor(Math.log10(n))+1);}
    static int count(String s , char c){int count=0;for (int i = 0; i < s.length(); i++) {if(s.charAt(i)==c)count++;}return count;}
    static int count(char[] s , char c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(int[] s , int c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(long[] s , long c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(double[] s , double c){int count=0;for (int i = 0; i < s.length; i++) {if(s[i]==c)count++;}return count;}
    static int count(List<String> s , String c){int count=0;for (int i = 0; i < s.size(); i++) {if(s.get(i)==c)count++;}return count;}
    static int[] countAll(String s){int[] alpha = new int[26];for (int i = 0; i < s.length(); i++) {alpha[(int)s.charAt(i)-97]++;}return alpha;}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int sqrt(int n){return (int)Math.sqrt(n);}
    static long sqrt(long n){return (long)Math.sqrt(n);}
    static double sqrt(double n){return Math.sqrt(n);}
    static int floori(double d) {return (int)Math.floor(d);}
    static int ceili(double d) {return (int)Math.ceil(d);}
    static long floorl(double d) {return (long)Math.floor(d);}
    static long ceill(double d) {return (long)Math.ceil(d);}
    static long lcm(long a, long b) {return (a * b) / gcd(a, b);}
    static long gcd(long a, long b) {if (a == 0)return b; return gcd(b % a, a);}
    static int lcm(int a, int b) {return (a * b) / gcd(a, b);}
    static int gcd(int a, int b) {if (a == 0)return b; return gcd(b % a, a);}
    static boolean prime(int n) {for (int i = 2; i <= sqrt(n); i++) {if(n%i==0)return false;}return true ;}
    static int randInt(int min, int max) {return rand.nextInt(max - min + 1) + min;}

    // array util
    static boolean vowel(char c) {if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y')return true; else return false ;}
    static void reverse(int[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(long[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(double[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(char[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static <T> void reverse(T[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {T swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void shuffle(int[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(long[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(double[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(char[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); char swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static <T> void shuffle(T[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); T swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void rsort(int[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(long[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(double[] a) {shuffle(a); Arrays.sort(a);}
    static void rsort(char[] a) {shuffle(a); Arrays.sort(a);}
    static <T> void rsort(T[] a) {shuffle(a); Arrays.sort(a);}
    static String leftPad(String str , int n , String s){String temp="";for (int i = 0; i < n-str.length(); i++) {temp+=s;} temp+=str; return temp;}
    static String rightPad(String str , int n , String s){for (int i = 0; i < n-str.length(); i++) {str+=s;}return str;}

    //input
    static int nxti() throws NumberFormatException, IOException {return rd.nextInt();}
    static long nxtl() throws NumberFormatException, IOException {return rd.nextLong();}
    static double nxtd() throws NumberFormatException, IOException {return rd.nextDouble();}
    static char nxtc() throws NumberFormatException, IOException {return rd.nextChar();}
    static String nxt() throws IOException {return rd.next();}
    static int[] nxtira() throws NumberFormatException, IOException {return rd.nextIntArray();}
    // static int[][] nxtira(int r, int c){return rd.nextInt2DArray(r,c);}
    // static long[] nxtlra(int size){return rd.nextLongArray(size);}
    // static long[][] nxtlra(int r, int c){return rd.nextLong2DArray(r,c);}
    // static char[] nxtcra(){return rd.next().toCharArray();}
    // static String[] nxtsra(int size){return rd.nextStringArray(size);}

    // // output
    static void pr(int i) {rd.print(i);}
    static void prln(int i) {rd.println(i);}
    static void pr(long l) {rd.print(l);}
    static void prln(long l) {rd.println(l);}
    static void pr(double d) {rd.print(d);}
    static void prln(double d) {rd.println(d);}
    static void pr(char c) {rd.print(c);}
    static void prln(char c) {rd.println(c);}

    static void prln() {rd.println();}
    static void prln(char[] c) {rd.println(c);}
    static void pr(String s) {rd.print(s);}
    static void prln(String s) {rd.println(s);}
    static void pr(Object o) {System.out.print(o);}
    static void prln(Object o) {System.out.println(o);}
    static void pry() {rd.println("yes");}
    static void prYes() {rd.println("Yes");}
    static void prY() {rd.println("YES");}
    static void prn() {rd.println("no");}
    static void prNo() {rd.println("No");}
    static void prN() {rd.println("NO");}
    static void pryn(boolean b) {rd.println(b ? "yes" : "no");};
    static void prYesNo(boolean b) {System.out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {System.out.println(b ? "YES" : "NO");}
    static void pr(int[] a){rd.print(a);}
    static void prln(int[] a){rd.println(a);}
    static void pr(long[] a){rd.print(a);}
    static void prln(long[] a){rd.println(a);}
    static void pr(double[] a){rd.print(a);}
    static void prln(double[] a){rd.println(a);}
    static void prln(char[][] a){rd.println(a);}
    static void prln(boolean[][] a){rd.println(a);}
    // static void pr(String[] a){rd.print(a);}
    // static void prln(String[] a){rd.println(a);}
    // // static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; rd.print(iter.next()), rd.print(' '), ++i); rd.println(iter.next());}
    static void flush() {rd.flush();}
    static void close() {rd.close();}
}

class FastIO2{

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static String next() throws IOException {
        String s = br.readLine();
        return s;
    }

    public static int nextInt() throws NumberFormatException, IOException {
        int n = Integer.parseInt(next());
        return n;
    }

    public static long nextLong() throws NumberFormatException, IOException {
        long n = Long.parseLong(next());
        return n;
    }

    public static double nextDouble() throws NumberFormatException, IOException {
        double n = Double.parseDouble(next());
        return n;
    }

    public static char nextChar() throws NumberFormatException, IOException {
        String s = next();
        char c = s.charAt(0);
        return c;
    }

    public static int[] nextIntArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i]=Integer.parseInt(s[i]);
        }
        return a;
    }
    public static long[] nextLongArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i]=Long.parseLong(s[i]);
        }
        return a;
    }
    public static double[] nextDoubleArray() throws NumberFormatException, IOException {
        String[] s = next().split(" ");
        int size=s.length;
        double[] a = new double[size];
        for (int i = 0; i < size; i++) {
            a[i]=Double.parseDouble(s[i]);
        }
        return a;
    }

    public void print(int n){out.print(n);}
    public void print(long n){out.print(n);}
    public void print(float n){out.print(n);}
    public void print(double n){out.print(n);}
    public void print(char n){out.print(n);}
    public void print(String n){out.print(n);}
    public void print(boolean n){out.print(n);}
    public void print(Object n){out.print(n);}
    public void print(char[] c){out.print(c);}
    public void print(int[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(long[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(double[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }
    public void print(String[] a){
        for (int i = 0; i < a.length; i++) {
            if(i!=(a.length-1))out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }

    public void println(){out.println();}
    public void println(int s){out.println(s);}
    public void println(long s){out.println(s);}
    public void println(float s){out.println(s);}
    public void println(double s){out.println(s);}
    public void println(char s){out.println(s);}
    public void println(String s){out.println(s);}
    public void println(boolean s){out.println(s);}
    public void println(Object s){out.println(s);}
    public void println(char[] s){out.println(s);}
    public void println(int[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(long[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(double[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(String[] a){
        for (int i = 0; i < a.length; i++) {
            out.println(a[i]);
        }
    }
    public void println(int[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(long[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(double[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(char[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }
    public void println(boolean[][] c){
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[0].length; j++) {
                print(c[i][j] + " ");
            }
            println();
        }
    }

    public void flush(){out.flush();};
    public void close(){out.close();};
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <vector>
#include <set>
#include <math.h>
#include <algorithm>
#include <cstring>

using namespace std;

#define REP(a,b) for(int (a)=0;a<(int)b;a++)
#define FOR(a,b,c) for(int (a)=b;a<(int)c;a++)
#define MP(A,B) pair<long long, long long>(A,B)
#define PB push_back
#define s(a) scanf("%d",&a);
#define foreach(a,b) for(__typeof(b).begin() a  = b.begin(); a != b.end();a++)

int N;
int dp[10][30][30][30];
int sol[10][30][30][30];

int A;
int B;
int arr[10];

int Calc(int pos, int a, int b, int c)
{
	if(pos==N-1)
	{
		return 0;
	}

	if(dp[pos][a][b][c]==-1)
	{
		if(arr[pos]-a<0)
		{
			dp[pos][a][b][c]=Calc(pos+1,b,c,0);
			sol[pos][a][b][c]=2;
		}
		else
		{
			// do it on first
			int val1 = 1+Calc(pos,min(a+A,20),min(b+B,20),c);

			// do it on second
			int val2 = 1+Calc(pos,min(a+B,20),min(b+A,20),min(c+B,20));

			dp[pos][a][b][c]=min(val1,val2);

			if(val1<val2)
			{
				sol[pos][a][b][c]=0;
			}
			else
			{
				sol[pos][a][b][c]=1;
			}
		}
	}

	return dp[pos][a][b][c];

}

int main()
{
	s(N);s(A);s(B);
	REP(n,N) s(arr[n]);

	vector<int> solution;

	//cout<<"A : "<<A<<endl;

	while(arr[0]>=0)
	{
		solution.push_back(1);
		arr[0]-=B;
		arr[1]-=A;
		arr[2]-=B;
	}

	while(arr[N-1]>=0)
	{
		solution.push_back(N-2);
		arr[N-1]-=B;
		arr[N-2]-=A;
		arr[N-3]-=B;
	}

	memset(dp,-1,sizeof(dp));

	int pos=1;
	int a=0;
	int b=0;
	int c=0;

	//cout<<"Sol : "<<solution.size()<<endl;
	//cout<<"VAL : "<<Calc(1,0,0,0)<<endl;

	Calc(1,0,0,0);

	while(pos!=N-1)
	{
		if(sol[pos][a][b][c]==2)
		{
			pos++;
			a=b;
			b=c;
			c=0;
		}
		else if(sol[pos][a][b][c]==0)
		{
			solution.PB(pos);
			a= min(a+A,20);
			b= min(b+B,20);
		}
		else
		{
			solution.PB(pos+1);
			a= min(a+B,20);
			b= min(b+A,20);
			c= min(c+B,20);
		}

	}

	cout<<solution.size()<<endl;

	printf("%d",solution[0]+1);

	FOR(n,1,solution.size())
	{
		printf(" %d",solution[n]+1);
	}

	printf("\n");

}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <vector>
#include <set>
#include <math.h>
#include <algorithm>
#include <cstring>

using namespace std;

#define REP(a,b) for(int (a)=0;a<(int)b;a++)
#define FOR(a,b,c) for(int (a)=b;a<(int)c;a++)
#define MP(A,B) pair<long long, long long>(A,B)
#define PB push_back
#define s(a) scanf("%d",&a);
#define foreach(a,b) for(__typeof(b).begin() a  = b.begin(); a != b.end();a++)

int N;
int dp[10][20][20][20];
int sol[10][20][20][20];

int A;
int B;
int arr[10];

int Calc(int pos, int a, int b, int c)
{
	if(pos==N-1)
	{
		return 0;
	}

	if(dp[pos][a][b][c]==-1)
	{
		if(arr[pos]-a<=0)
		{
			dp[pos][a][b][c]=Calc(pos+1,b,c,0);
			sol[pos][a][b][c]=2;
		}
		else
		{
			// do it on first
			int val1 = 1+Calc(pos,min(a+A,20),min(b+B,20),c);

			// do it on second
			int val2 = 1+Calc(pos,min(a+B,20),min(b+A,20),min(b+B,20));

			dp[pos][a][b][c]=min(val1,val2);

			if(val1<val2)
			{
				sol[pos][a][b][c]=0;
			}
			else
			{
				sol[pos][a][b][c]=1;
			}
		}
	}

	return dp[pos][a][b][c];

}

int main()
{
	s(N);s(A);s(B);
	REP(n,N) s(arr[n]);
	REP(n,N) arr[n]++;

	vector<int> solution;

	//cout<<"A : "<<A<<endl;

	while(arr[0]>0)
	{
		solution.push_back(1);
		arr[0]-=B;
		arr[1]-=A;
		arr[2]-=B;
	}

	//REP(n,N)
	//{
	//	cout<<arr[n]<<" ";
	//}

	//cout<<endl;

	while(arr[N-1]>0)
	{
		solution.push_back(N-2);
		arr[N-1]-=B;
		arr[N-2]-=A;
		arr[N-3]-=B;
	}

	memset(dp,-1,sizeof(dp));

	int pos=1;
	int a=0;
	int b=0;
	int c=0;

	//cout<<"Sol : "<<solution.size()<<endl;
	//cout<<"VAL : "<<Calc(1,0,0,0)<<endl;

	Calc(1,0,0,0);

	while(pos!=N-1)
	{
		if(sol[pos][a][b][c]==2)
		{
			pos++;
			a=b;
			b=c;
			c=0;
		}
		else if(sol[pos][a][b][c]==0)
		{
			solution.PB(pos);
			a= min(a+A,20);
			b= min(b+B,20);
		}
		else
		{
			solution.PB(pos+1);
			c= min(b+B,20);
			b= min(b+A,20);
			a= min(a+B,20);
		}

	}

	cout<<solution.size()<<endl;

	printf("%d",solution[0]+1);

	FOR(n,1,solution.size())
	{
		printf(" %d",solution[n]+1);
	}

	printf("\n");

}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <vector>
#include <set>
#include <math.h>
#include <algorithm>
#include <cstring>

using namespace std;

#define REP(a,b) for(int (a)=0;a<(int)b;a++)
#define FOR(a,b,c) for(int (a)=b;a<(int)c;a++)
#define MP(A,B) pair<long long, long long>(A,B)
#define PB push_back
#define s(a) scanf("%d",&a);
#define foreach(a,b) for(__typeof(b).begin() a  = b.begin(); a != b.end();a++)

int N;
int dp[10][30][30][30];
int sol[10][30][30][30];

int A;
int B;
int arr[10];

int Calc(int pos, int a, int b, int c)
{
	if(pos==N-1)
	{
		return 0;
	}

	if(dp[pos][a][b][c]==-1)
	{
		if(arr[pos]-a<=0)
		{
			dp[pos][a][b][c]=Calc(pos+1,b,c,0);
			sol[pos][a][b][c]=2;
		}
		else
		{
			// do it on first
			int val1 = 1+Calc(pos,a+A,b+B,c);

			// do it on second
			int val2 = 1+Calc(pos,a+B,b+A,b+B);

			dp[pos][a][b][c]=min(val1,val2);

			if(val1<val2)
			{
				sol[pos][a][b][c]=0;
			}
			else
			{
				sol[pos][a][b][c]=1;
			}
		}
	}

	return dp[pos][a][b][c];

}

int main()
{
	s(N);s(A);s(B);
	REP(n,N) s(arr[n]);
	REP(n,N) arr[n]++;

	vector<int> solution;

	//cout<<"A : "<<A<<endl;

	while(arr[0]>0)
	{
		solution.push_back(1);
		arr[0]-=B;
		arr[1]-=A;
		arr[2]-=B;
	}

	//REP(n,N)
	//{
	//	cout<<arr[n]<<" ";
	//}

	//cout<<endl;

	while(arr[N-1]>0)
	{
		solution.push_back(N-2);
		arr[N-1]-=B;
		arr[N-2]-=A;
		arr[N-3]-=B;
	}

	memset(dp,-1,sizeof(dp));

	int pos=1;
	int a=0;
	int b=0;
	int c=0;

//	cout<<"Sol : "<<solution.size()<<endl;
//	cout<<"VAL : "<<Calc(1,0,0,0)<<endl;

	Calc(1,0,0,0);

	while(pos!=N-1)
	{
		if(sol[pos][a][b][c]==2)
		{
			pos++;
			a=b;
			b=c;
			c=0;
		}
		else if(sol[pos][a][b][c]==1)
		{
			a+=A;
			b+=B;
			c= c;
			solution.PB(pos);
		}
		else if(sol[pos][a][b][c]==0)
		{
			a+=B;
			b+=A;
			c+=B;
			solution.PB(pos+1);
		}
	}

	cout<<solution.size()<<endl;

	printf("%d",solution[0]+1);

	FOR(n,1,solution.size())
	{
		printf(" %d",solution[n]+1);
	}

	printf("\n");

}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <vector>
#include <set>
#include <math.h>
#include <algorithm>
#include <cstring>

using namespace std;

#define REP(a,b) for(int (a)=0;a<(int)b;a++)
#define FOR(a,b,c) for(int (a)=b;a<(int)c;a++)
#define MP(A,B) pair<long long, long long>(A,B)
#define PB push_back
#define s(a) scanf("%d",&a);
#define foreach(a,b) for(__typeof(b).begin() a  = b.begin(); a != b.end();a++)

int N;
int dp[10][20][20][20];
int sol[10][20][20][20];

int A;
int B;
int arr[10];

int Calc(int pos, int a, int b, int c)
{
	if(pos==N-1)
	{
		return 0;
	}

	if(dp[pos][a][b][c]==-1)
	{
		if(arr[pos]-a<0)
		{
			dp[pos][a][b][c]=Calc(pos+1,b,c,0);
			sol[pos][a][b][c]=2;
		}
		else
		{
			// do it on first
			int val1 = 1+Calc(pos,min(a+A,20),min(b+B,20),c);

			// do it on second
			int val2 = 1+Calc(pos,min(a+B,20),min(b+A,20),min(c+B,20));

			dp[pos][a][b][c]=min(val1,val2);

			if(val1<val2)
			{
				sol[pos][a][b][c]=0;
			}
			else
			{
				sol[pos][a][b][c]=1;
			}
		}
	}

	return dp[pos][a][b][c];

}

int main()
{
	s(N);s(A);s(B);
	REP(n,N) s(arr[n]);

	vector<int> solution;

	//cout<<"A : "<<A<<endl;

	while(arr[0]>=0)
	{
		solution.push_back(1);
		arr[0]-=B;
		arr[1]-=A;
		arr[2]-=B;
	}

	//REP(n,N)
	//{
	//	cout<<arr[n]<<" ";
	//}

	//cout<<endl;

	while(arr[N-1]>=0)
	{
		solution.push_back(N-2);
		arr[N-1]-=B;
		arr[N-2]-=A;
		arr[N-3]-=B;
	}

	memset(dp,-1,sizeof(dp));

	int pos=1;
	int a=0;
	int b=0;
	int c=0;

	//cout<<"Sol : "<<solution.size()<<endl;
	//cout<<"VAL : "<<Calc(1,0,0,0)<<endl;

	Calc(1,0,0,0);

	while(pos!=N-1)
	{
		if(sol[pos][a][b][c]==2)
		{
			pos++;
			a=b;
			b=c;
			c=0;
		}
		else if(sol[pos][a][b][c]==0)
		{
			solution.PB(pos);
			a= min(a+A,20);
			b= min(b+B,20);
		}
		else
		{
			solution.PB(pos+1);
			c= min(c+B,20);
			b= min(b+A,20);
			a= min(a+B,20);
		}

	}

	cout<<solution.size()<<endl;

	printf("%d",solution[0]+1);

	FOR(n,1,solution.size())
	{
		printf(" %d",solution[n]+1);
	}

	printf("\n");

}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int n, a, b;
map < vector < int > , int > dp, par;

int f( vector < int > h )
{
	if( dp.count( h ) )
		return dp[h];
	int ret = 1000000, id = -1;
	for( int i = 1 ; i+1 < h.size() ; i ++ )
		if( h[i] >= 0 || h[i-1] >= 0 || h[i+1] >= 0 )
		{
			vector < int > tmp = h;
			tmp[i] -= a;
			tmp[i-1] -= b;
			tmp[i+1] -= b;
			int x = 1 + f( tmp );
			if( x < ret )
				ret = x, id = i;
		}
	if( ret == 1000000 )
		ret = 0;
	par[h] = id;
	return dp[h] = ret;
}

int main()
{
	cin >> n >> a >> b;
	vector < int > ans;
	vector < int > h( n );
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		ans.push_back( 2 );
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
	}
	while( h[n-1] >= 0 )
	{
		ans.push_back( n-1 );
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
	}
	f( h );
	int bad = 1;
	while( 1 )
	{
		for( int i = bad = 0 ; i < h.size() ; i ++ )
			if( h[i] >= 0 )
				bad = 1;
		if( !bad )
			break;
		int x = par[h];
		ans.push_back( x+1 );
		h[x] -= a;
		h[x-1] -= b;
		h[x+1] -= b;
	}
	cout << ans.size() << endl;
	for( int i = 0 ; i < ans.size() ; i ++ )
		cout << ans[i] << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int n, a, b;
map < vector < int > , int > dp, par;

int f( vector < int > h )
{
	if( dp.count( h ) )
		return dp[h];
	vector < int > tmp;
	int ret = 1000000, id = -1;
	for( int i = 1 ; i+1 < h.size() ; i ++ )
		if( h[i] >= 0 || h[i-1] >= 0 || h[i+1] >= 0 )
		{
			tmp = h;
			tmp[i] -= a;
			tmp[i-1] -= b;
			tmp[i+1] -= b;
			int x = 1 + f( tmp );
			if( x < ret )
				ret = x, id = i;
		}
	if( ret == 1000000 )
		ret = 0;
	par[h] = id;
	return dp[h] = ret;
}

int main()
{
	cin >> n >> a >> b;
	vector < int > ans;
	vector < int > h( n );
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		ans.push_back( 2 );
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
	}
	while( h[n-1] >= 0 )
	{
		ans.push_back( n-1 );
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
	}
	h.erase( h.begin() );
	h.pop_back();
	f( h );
	int bad = 1;
	while( 1 )
	{
		for( int i = bad = 0 ; i < h.size() ; i ++ )
			if( h[i] >= 0 )
				bad = 1;
		if( !bad )
			break;
		int x = par[h];
		ans.push_back( x+2 );
		h[x] -= a;
		h[x-1] -= b;
		h[x+1] -= b;
	}
	cout << ans.size() << endl;
	for( int i = 0 ; i < ans.size() ; i ++ )
		cout << ans[i] << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int n, a, b;
map < LL , int > dp, par;
vector < int > tmp;

LL code( vector < int > a )
{
	LL ret = 0;
	for( LL i = 0, r = 1 ; i < a.size() ; i ++, r *= 100 )
		ret += a[i] * r;
	return ret;
}
int get( LL x , int id )
{
	if( id < 0 || id > n-2 )
		return 0;
	for( int i = 0 ; i < id ; i ++ )
		x /= 100;
	return x % 100;
}
LL hit( LL x , int id )
{
	tmp.clear();
	for( int i = 0 ; i < n-2 ; i ++ )
		tmp.push_back( get( x , i ) );
	if( id-1 >= 0 )
		tmp[id-1] = max( 0 , tmp[id-1] - b );
	tmp[id] = max( 0 , tmp[id] - a );
	if( id+1 < n-2 )
		tmp[id+1] = max( 0 , tmp[id+1] - b );
	return code( tmp );
}

int f( LL x )
{
	if( dp.count( x ) )
		return dp[x];
	int ret = 1000000, id = -1;
	for( int i = 0 ; i < n-2 ; i ++ )
		if( get( x , i ) || get( x , i-1 ) || get( x , i+1 ) )
		{
			int r = f( hit( x , i ) ) + 1;
			if( r < ret )
				ret = r, id = i;
		}
	par[x] = id;
	if( ret == 1000000 )
		ret = 0;
	return dp[x] = ret;
}

int main()
{
	cin >> n >> a >> b;
	vector < int > ans;
	vector < int > h( n );
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i], h[i] ++;
	while( h[0] > 0 )
	{
		ans.push_back( 2 );
		h[0] = max( 0 , h[0] - b );
		h[1] = max( 0 , h[1] - a );
		h[2] = max( 0 , h[2] - b );
	}
	while( h[n-1] > 0 )
	{
		ans.push_back( n-1 );
		h[n-1] = max( 0 , h[n-1] - b );
		h[n-2] = max( 0 , h[n-2] - a );
		h[n-3] = max( 0 , h[n-3] - b );
	}
	h.erase( h.begin() );
	h.pop_back();
	LL hh = code( h );
	f( hh );
	while( par[hh] != -1 )
	{
		ans.push_back( 2 + par[hh] );
		hh = hit( hh , par[hh] );
	}
	cout << ans.size() << endl;
	for( int i = 0 ; i < ans.size() ; i ++ )
		cout << ans[i] << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int h[16], n, a, b;
int st[1<<15];
int ans, res[1<<15], sz;

void bt( int x )
{
	int ok = 1;
	for( int i = 0 ; i < n ; i ++ )
		if( h[i] >= 0 )
			ok = 0;
	if( ok )
	{
		if( sz == -1 || x < sz )
		{
			sz = 0;
			for( int i = 0 ; i < x ; i ++ )
				res[ sz++ ] = st[i];
		}
		return;
	}
	if( sz != -1 && x >= sz )
		return;
	for( int i = 0 ; i < n ; i ++ )
		if( h[i] >= 0 )
		{
			st[x] = i;
			h[i] -= a;
			h[i-1] -= b;
			h[i+1] -= b;
			bt( x+1 );
			h[i] += a;
			h[i-1] += b;
			h[i+1] += b;
			st[x] = -1;
		}
}

int main()
{
	int ans = 0;
	vector < int > all;
	cin >> n >> a >> b;
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
		ans ++;
		all.push_back( 2 );
	}
	while( h[n-1] >= 0 )
	{
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
		all.push_back( n-1 );
		ans ++;
	}
	sz = -1;
	bt( 0 );
	cout << ans + sz << endl;
	for( int i = 0 ; i < ans ; i ++ )
		cout << all[i] << " ";
	for( int i = 0 ; i < sz ; i ++ )
		cout << res[i]+1 << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int n, a, b;
map < vector < int > , int > dp, par;

int f( vector < int > h )
{
	if( dp.count( h ) )
		return dp[h];
	int ret = 1000000, id = -1;
	for( int i = 1 ; i+1 < h.size() ; i ++ )
		if( h[i] >= 0 || h[i-1] >= 0 || h[i+1] >= 0 )
		{
			vector < int > tmp = h;
			tmp[i] -= a;
			tmp[i-1] -= b;
			tmp[i+1] -= b;
			int x = 1 + f( tmp );
			if( x < ret )
				ret = x, id = i;
		}
	if( ret == 1000000 )
		ret = 0;
	par[h] = id;
	return dp[h] = ret;
}

int main()
{
	cin >> n >> a >> b;
	vector < int > ans;
	vector < int > h( n );
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		ans.push_back( 2 );
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
	}
	while( h[n-1] >= 0 )
	{
		ans.push_back( n-1 );
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
	}
	h.erase( h.begin() );
	h.pop_back();
	f( h );
	int bad = 1;
	while( 1 )
	{
		for( int i = bad = 0 ; i < h.size() ; i ++ )
			if( h[i] >= 0 )
				bad = 1;
		if( !bad )
			break;
		int x = par[h];
		ans.push_back( x+2 );
		h[x] -= a;
		h[x-1] -= b;
		h[x+1] -= b;
	}
	cout << ans.size() << endl;
	for( int i = 0 ; i < ans.size() ; i ++ )
		cout << ans[i] << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int n, a, b;
map < vector < int > , int > dp, par;

int f( vector < int > h )
{
	if( dp.count( h ) )
		return dp[h];
	int ret = 1000000, id = -1;
	for( int i = 1 ; i+1 < h.size() ; i ++ )
		if( h[i] >= 0 )
		{
			vector < int > tmp = h;
			tmp[i] -= a;
			tmp[i-1] -= b;
			tmp[i+1] -= b;
			int x = 1 + f( tmp );
			if( x < ret )
				ret = x, id = i;
		}
	if( ret == 1000000 )
		ret = 0;
	par[h] = id;
	return dp[h] = ret;
}

int main()
{
	cin >> n >> a >> b;
	vector < int > ans;
	vector < int > h( n );
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		ans.push_back( 2 );
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
	}
	while( h[n-1] >= 0 )
	{
		ans.push_back( n-1 );
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
	}
	f( h );
	int bad = 1;
	while( 1 )
	{
		for( int i = bad = 0 ; i < h.size() ; i ++ )
			if( h[i] >= 0 )
				bad = 1;
		if( !bad )
			break;
		int x = par[h];
		ans.push_back( x+1 );
		h[x] -= a;
		h[x-1] -= b;
		h[x+1] -= b;
	}
	cout << ans.size() << endl;
	for( int i = 0 ; i < ans.size() ; i ++ )
		cout << ans[i] << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int h[16], n, a, b;
int st[1<<15];
int ans, res[1<<15], sz;

void bt( int x )
{
	int ok = 1;
	for( int i = 0 ; i < n ; i ++ )
		if( h[i] >= 0 )
			ok = 0;
	if( ok )
	{
		if( sz == -1 || x < sz )
		{
			sz = 0;
			for( int i = 0 ; i < x ; i ++ )
				res[ sz++ ] = st[i];
		}
		return;
	}
	if( sz != -1 && x >= sz )
		return;
	for( int i = 0 ; i < n ; i ++ )
		if( h[i] >= 0 )
		{
			st[x] = i;
			h[i] -= a;
			h[i-1] -= b;
			h[i+1] -= b;
			bt( x+1 );
			h[i] += a;
			h[i-1] += b;
			h[i+1] += b;
			st[x] = -1;
		}
}

int main()
{
	int ans = 0;
	vector < int > all;
	cin >> n >> a >> b;
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
		ans ++;
		all.push_back( 2 );
	}
	while( h[n-1] >= 0 )
	{
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
		all.push_back( n-1 );
		ans ++;
	}
	sz = -1;
	bt( 0 );
	cout << ans + sz << endl;
	for( int i = 0 ; i < ans ; i ++ )
		cout << all[i] << " ";
	for( int i = 0 ; i < sz ; i ++ )
		cout << res[i] << " ";
	cout << endl;
	return 0;
}


#include <list>
#include <set>
#include <map>
#include <ctime>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <deque>
#include <bitset>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <iterator>
#include <cassert>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <complex>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define int64 LL

typedef vector < int > VI;
typedef pair< int , int > pii;
typedef pair < LL , LL > PLL;
#define fr first
#define se second
#define pi M_PI
#define rad(x) (x)*acos(-1)/180.0
#define EPS 1e-6
#define INF 10000*10000*10000LL
stringstream ss;
#define two(x) ( 1LL<<x )
#define sq(x) ( (x)*(x) )
LL mod = 1000000007LL;

/**************************Code****************************/

int h[16], n, a, b;
int st[1<<15];
int ans, res[1<<15], sz;

void bt( int x )
{
	int ok = 1;
	for( int i = 0 ; i < n ; i ++ )
		if( h[i] >= 0 )
			ok = 0;
	if( ok )
	{
		if( x < sz )
		{
			sz = 0;
			for( int i = 0 ; i < x ; i ++ )
				res[ sz++ ] = st[i];
		}
		return;
	}
	if( x >= sz )
		return;
	for( int i = 0 ; i < n ; i ++ )
		if( h[i] >= 0 )
		{
			st[x] = i;
			h[i] -= a;
			h[i-1] -= b;
			h[i+1] -= b;
			bt( x+1 );
			h[i] += a;
			h[i-1] += b;
			h[i+1] += b;
			st[x] = -1;
		}
}

int main()
{
	int ans = 0;
	vector < int > all;
	cin >> n >> a >> b;
	for( int i = 0 ; i < n ; i ++ )
		cin >> h[i];
	while( h[0] >= 0 )
	{
		h[0] -= b;
		h[1] -= a;
		h[2] -= b;
		ans ++;
		all.push_back( 2 );
	}
	while( h[n-1] >= 0 )
	{
		h[n-1] -= b;
		h[n-2] -= a;
		h[n-3] -= b;
		all.push_back( n-1 );
		ans ++;
	}
	bt( 0 );
	cout << ans + sz << endl;
	for( int i = 0 ; i < ans ; i ++ )
		cout << all[i] << " ";
	for( int i = 0 ; i < sz ; i ++ )
		cout << res[i] << " ";
	cout << endl;
	return 0;
}


#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1e9+7

int n,a,b,tot=INF;
int ans[20],h[20];
int cnt[20],ret[20];

void Dfs(int x) {
	int fm=ceil(1.0*h[x-1]/b),to=max(ceil(1.0*h[x]/a),ceil(1.0*h[x+1]/b));
	fm=max(0,fm);
	to=max(fm,to);
	if(x==n-1) {
		cnt[x]=max(to,0);
		ret[x]=ret[x-1]+cnt[x];
		if(ret[x]<tot) {
			tot=ret[x];
			for(int i=2;i<n;i++)
				ans[i]=cnt[i];
		}
		return ;
	}
	for(int fir=fm;fir<=to;fir++) {
		h[x-1]-=fir*b,h[x]-=fir*a,h[x+1]-=fir*b;
		ret[x]=ret[x-1]+fir,cnt[x]=fir;
		Dfs(x+1);
		h[x-1]+=fir*b,h[x]+=fir*a,h[x+1]+=fir*b;
	}
}
int main() {
	fill(ret+2,ret+20,INF);
	scanf("%d %d %d\n",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]),h[i]++;
	Dfs(2);
	printf("%d\n",tot);
	for(int i=2;i<n;i++)
		while(ans[i]--)
			printf("%d ",i);
	puts("");
	return 0;
}


#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1e9+7

int n,a,b;
int h[20],cnt[20],ret[20];

int Dfs(int x,int l,int m,int r) {
	int fm=ceil(1.0*l/b),to=max(ceil(1.0*m/a),ceil(1.0*r/b));
	to=max(fm,to);
	if(x==n-1) {
		cnt[x]=to;
		return to;
	}
	for(int fir=max(0,fm);fir<=to;fir++) {
		int tm=m-fir*a,tr=r-fir*b;
		int tmp=Dfs(x+1,tm,tr,h[x+2])+fir;
		if(tmp<ret[x])
			ret[x]=tmp,cnt[x]=fir;
	}
	return ret[x];
}
int main() {
	fill(ret,ret+20,INF);
	scanf("%d %d %d\n",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]),h[i]++;
	printf("%d\n",Dfs(2,h[1],h[2],h[3]));
	for(int i=2;i<n;i++)
		while(cnt[i]--)
			printf("%d ",i);
	puts("");
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1e9+7

int n,a,b;
int h[20],cnt[20];

int Dfs(int x,int l,int m,int r) {
	int fm=l/b+1,to=max(fm,max(m/a+1,r/b+1)),ret=INF,sav=0;
	if(x==n-1) {
		cnt[x]=to;
		return to;
	}
	for(int fir=max(0,fm);fir<=to;fir++) {
		int tm=m-fir*a,tr=r-fir*b;
		int tmp=Dfs(x+1,tm,tr,h[x+2])+fir;
		if(tmp<ret)
			ret=tmp,sav=fir;
	}
	cnt[x]=sav;
	return ret;
}
int main() {
	scanf("%d %d %d\n",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	printf("%d\n",Dfs(2,h[1],h[2],h[3]));
	for(int i=2;i<n;i++)
		while(cnt[i]--)
			printf("%d ",i);
	puts("");
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1e9+7

int n,a,b;
int h[20],cnt[20];

int Dfs(int x,int l,int m,int r) {
	int fm=l/b+1,to=max(fm,max(m/a+1,r/b+1)),ret=INF,sav=0;
	if(x==n-1) {
		cnt[x]=to;
		return to;
	}
	for(int fir=fm;fir<=to;fir++) {
		int tm=max(m-fir*a,0),tr=max(r-fir*b,0);
		int tmp=Dfs(x+1,tm,tr,h[x+2])+fir;
		if(tmp<ret)
			ret=tmp,sav=fir;
	}
	cnt[x]=sav;
	return ret;
}
int main() {
	scanf("%d %d %d\n",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	printf("%d\n",Dfs(2,h[1],h[2],h[3]));
	for(int i=2;i<n;i++)
		while(cnt[i]--)
			printf("%d ",i);
	puts("");
	return 0;
}


#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1e9+7

int n,a,b,tot=INF;
int ans[20],h[20];
int cnt[20],ret[20];

void Dfs(int x) {
	if(ret[x-1]>tot) return ;
	int fm=ceil(1.0*h[x-1]/b),to=max(ceil(1.0*h[x]/a),ceil(1.0*h[x+1]/b));
	fm=max(0,fm);
	to=max(fm,to);
	if(x==n-1) {
		cnt[x]=max(to,0);
		ret[x]=ret[x-1]+cnt[x];
		if(ret[x]<tot) {
			tot=ret[x];
			for(int i=2;i<n;i++)
				ans[i]=cnt[i];
		}
		return ;
	}
	for(int fir=fm;fir<=to;fir++) {
		h[x-1]-=fir*b,h[x]-=fir*a,h[x+1]-=fir*b;
		ret[x]=ret[x-1]+fir,cnt[x]=fir;
		Dfs(x+1);
		h[x-1]+=fir*b,h[x]+=fir*a,h[x+1]+=fir*b;
	}
}
int main() {
	fill(ret+2,ret+20,INF);
	scanf("%d %d %d\n",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]),h[i]++;
	Dfs(2);
	printf("%d\n",tot);
	for(int i=2;i<n;i++)
		while(ans[i]--)
			printf("%d ",i);
	puts("");
	return 0;
}


#include <cstring>
#include <string.h>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <memory.h>
using namespace std;
const int OO=(int)1e8;
int n;
int arr[12];
int a,b;
int memo[11][16][16][16];
int dp(int idx,int h1,int h2,int h3)
{
	if(idx==n-1 && h1<=0 &&h2<=0 &&h3<=0)
		return 0;
	if(idx==n-1)
		return OO;
	int &x=memo[idx][h1][h2][h3];
	int mn=(h1+b-1)/b;
	int ret=OO;
	for(int i=mn;i<20;++i)
	{
		ret=min(ret,i+dp(idx+1,h2-(i*a),h3-(i*b),arr[idx+2]));
	}
	return x=ret;
}
bool f=0;
void build(int idx,int h1,int h2,int h3)
{
	if(idx==n-1 && h1<=0 &&h2<=0 &&h3<=0)
		return ;
	if(idx==n-1)
		return ;
	int x=dp(idx,h1,h2,h3);
	int mn=(h1+b-1)/b;
	int ret=OO;
	for(int i=mn;i<20;++i)
	{
		ret=min(ret,i+dp(idx+1,h2-(i*a),h3-(i*b),arr[idx+2]));
		if(ret==x)
		{
			for(int j=0;j<i;++j)
			{
				if(f)
					cout<<" ";
				f=1;
				cout<<idx+1;
			}
			build(idx+1,h2-(i*a),h3-(i*b),arr[idx+2]);
			break;
		}
	}

	return ;
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("1.txt","r",stdin);
	#endif
	cin>>n>>a>>b;
	memset(memo,-1,sizeof memo);
	arr[n]=-1;
	for(int i=0;i<n;++i)
	{
		cin>>arr[i];
		arr[i]++;
	}
	cout<<dp(1,arr[0],arr[1],arr[2])<<endl;
	build(1,arr[0],arr[1],arr[2]);
	return 0;
}