#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); long long n, m; cin >> n >> m; double p; cin >> p; if (n > m) { swap(n, m); } vector c(5); if (n == 1) { if (m == 1) { c[0] = 1; } else { c[1] = 2; c[2] = m - 2; } } else { c[2] = 4; c[3] = 2 * (n + m - 4); c[4] = n * m - c[2] - c[3]; } double res = 0; for (int x = 0; x <= 4; ++x) { res += c[x] * pow(p, x + 1); } cout << fixed << setprecision(15) << res << '\n'; }