import java.util.Scanner;
public class Main{
static Scanner in = new Scanner(System.in);
static long mod;
public static long qpower(long x, long y){
long res = 1;
for(; y > 0; y >>= 1, x = (x*x) % mod)
if((y&1) == 1){
res = (res * x) % mod;
}
return res;
}
public static void main(String[] args){
long a, b, c, d;
a = in.nextLong();
b = in.nextLong();
c = in.nextLong();
d = in.nextLong();
mod = in.nextLong();
System.out.println(qpower((a % mod) * (b % mod) % mod, c * d) % mod);
}
}

京公网安备 11010502036488号