#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, d, t;
  cin >> k >> d >> t;
  long long c = (k / d + (k % d != 0)) * d;
  d = c;
  long long cur = 2 * k + d - k;
  long long cnt = 2 * t / cur * d, last = 2 * t % cur;
  if (last > 2 * k) {
    cnt += k, last -= 2 * k;
    cout << cnt + last << endl;
  } else {
    cnt += last / 2;
    if (last & 1)
      cout << cnt << ".5" << endl;
    else
      cout << cnt << endl;
  }
  return 0;
}
