import java.io.*;  
 
public class Ejercicio4
{  
  public static long factorial(int n)  
  {
    if (n == 0) return 1;
    return n * factorial(n-1);
  }
    
  public static long combinaciones(int n, int k)  
  {
    long n_sobre_k = 0L;
    n_sobre_k = factorial(n) / (factorial(k) * factorial(n-k));
    return n_sobre_k;
  }
    
  public static long potencia(int b, int e)  
  {
    return (long)Math.pow(b, e);
  }  

  public static void main(String[] arg)
  {
    PrintStream flujoS = System.out;
    int a = 0, b = 0,x = 0,y = 0, n = 0;
    long res = 0L;
         
    flujoS.print("a = ");
    a = Leer.datoInt();
    flujoS.print("x = ");
    x = Leer.datoInt();
    flujoS.print("b = ");
    b = Leer.datoInt();
    flujoS.print("y = ");
    y = Leer.datoInt();
    flujoS.print("n = ");
    n = Leer.datoInt();
    if ((a * x + b * y == 0) && (n == 0))
      flujoS.println("Indeterminado");
    else
    {
      flujoS.print("El valor de la expresión (ax + by)^n = ");
      for (int k = 0; k <= n; k++)
        res += combinaciones(n, k) * potencia(a*x, n-k) * potencia(b*y, k);
      flujoS.println(res);
    }
  }
}