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