#include <bits/stdc++.h>
using namespace std;
const long long inff = 0x3f3f3f3f3f3f3f3f;
int main() {
  cin.tie(0);
  long long k, d, t, qw, e;
  scanf("%I64d", &k), scanf("%I64d", &d), scanf("%I64d", &t);
  qw = (k / d + 1) * d;
  if (k % d == 0) {
    cout << t << endl;
    return 0;
  }
  double s = 0.0, zz, po;
  po = (qw - k) * 0.5 + k;
  e = 2ll * t / (qw + k);
  e *= qw;
  s += e;
  e /= qw;
  zz = t - e * po;
  if (zz <= k) {
    s += zz;
  } else {
    s += k;
    zz -= k;
    s += zz * 2.0;
  }
  printf("%.10f\n", s);
  return 0;
}
