import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } double pow(double a,long n) { double ret=1; for(;n>0;n/=2,a*=a)if(n%2==1)ret*=a; return ret; } void run() { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); double p=sc.nextDouble(); long center=Math.max(n-2, 0)*Math.max(m-2, 0); long lateral_side=Math.max(m-2,0)*Math.min(n,2); long vertical_side=Math.max(n-2, 0)*Math.min(m,2); long corner=Math.min(2, n)*Math.min(2, m); long area_center=5; long area_corner=1+Math.min(n-1,1)+Math.min(m-1,1); long area_lateral_side=3+Math.min(n-1, 1); long area_vertical_side=3+Math.min(m-1, 1); System.out.println(center*pow(p,area_center)+corner*pow(p,area_corner)+lateral_side*pow(p,area_lateral_side)+vertical_side*pow(p,area_vertical_side)); } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }