#include #include #include using namespace std; int main() { int N, M; double P; cin >> N >> M >> P; vector ways(6); if (N > M) swap(N, M); if (N == 1 && M == 1) { ways[1] = 1; } else if (N == 1) { ways[2] = 2; ways[3] = M - 2; } else { ways[3] = 4; ways[4] = 2LL * (N + M) - 8; ways[5] = 1LL * N * M - ways[3] - ways[4]; } double ans = 0.0; for (int i = 1; i <= 5; ++i) { ans += ways[i] * pow(P, i); } cout.precision(15); cout << ans << endl; return 0; }