#include <bits/stdc++.h>
using namespace std;
unsigned long long int cei(unsigned long long int a, unsigned long long int b) {
  return (a % b == 0 ? a / b : a / b + 1);
}
unsigned long long int k, d, t;
signed main() {
  cout << fixed << setprecision(0);
  cin >> k >> d >> t;
  t = t << 1;
  d = cei(k, d) * d;
  unsigned long long int gongxian = (k + d);
  double T = 0;
  bool need = false;
  T = t / gongxian * d;
  t %= gongxian;
  if (t >= 2 * k) {
    t -= 2 * k;
    T += k;
    T += t;
    t = 0;
  } else {
    if (t % 2) need = true;
    T += t / 2;
  }
  cout << T;
  if (need)
    cout << ".5" << endl;
  else
    cout << ".0" << endl;
}
