#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 1;
const long long MOD = 1e9 + 7;
const int MX = 200015;
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  long long d = ceil(a / (b + 0.0)) * b;
  double res = 0;
  double am = d - (d - a) * 0.5;
  res += floor(c / am) * d;
  c = c - (floor(c / am) * am);
  while (c != 0) {
    if (c <= a) {
      res += c;
      break;
    }
    res += a;
    c -= a;
    res += c * 2;
    break;
  }
  cout << setprecision(12) << fixed << res;
}
