#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int k, d, t;
  cin >> k >> d >> t;
  if (k % d == 0) {
    printf("%.10f\n", (double)t);
    return 0;
  } else {
    long long int n = k / d;
    long long int m = (n + 1) * d;
    double sum = 0;
    double ans = k + (m - k) * 0.5;
    long long int cnt = t / ans;
    sum += cnt * m;
    double left = t - ans * cnt;
    if (left <= k)
      sum += left;
    else
      sum += k + (left - k) * 2;
    printf("%.10f\n", sum);
  }
  return 0;
}
