require 'prime' def x(a,d,n,t) d==a.size ? yield(n,t) : (0..a[d][1]).map{|i|x(a,d+1,n*a[d][0]**i,i==0 ? t : t*(a[d][0]-1)*a[d][0]**(i-1),&proc)} end def pow(x,y,m) z=1 while y>0 z=z*x%m if y%2>0 x=x*x%m y/=2 end z end C={} M=1000000007 H,W,K=gets.split.map &:to_i B=W.prime_division x(H.prime_division,r=0,1,1){|a,at| x(B,0,1,1){|b,bt| k=W*H*a.gcd(b)/a/b C[k]=pow(K,k,M) if !C.has_key?k r=(r+at*bt*C[k])%M } } p r*pow(W*H,M-2,M)%M