#include <bits/stdc++.h>
using namespace std;
long long on, ret, t, inter, vkl, izkl;
const long long one = 1;
const long long RIGHT = (one << 62);
long long interh;
long long ready(long long cur) {
  long long res = 0;
  long long s = cur / inter;
  res += s * interh;
  long long rem = cur % inter;
  if (rem <= vkl) {
    res += 2 * rem;
  } else {
    res += 2 * vkl;
    res += rem - vkl;
  }
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> on >> ret >> t;
  if (on % ret == 0) {
    cout << t << '\n';
    return 0;
  }
  inter = ret * ((on / ret) + 1);
  vkl = on;
  izkl = inter - vkl;
  interh = 2 * vkl + izkl;
  t += t;
  long long l = 0, r = RIGHT;
  long long lastmid, lastre;
  while (l <= r) {
    long long mid = (l + r) / 2;
    long long re = ready(mid);
    if (re >= t) {
      lastre = re;
      lastmid = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (lastre > t) {
    cout << lastmid - 1 << ".5\n";
  } else {
    cout << lastmid << '\n';
  }
  return 0;
}
