#include <bits/stdc++.h>
using namespace std;
long long int n, m, t, cnt;
double ans = 0;
void sovel1() {
  long long int all = n * 2 + m - n;
  long long int a = cnt / all;
  long long int b = cnt % all;
  ans += a * m;
  if (b <= n * 2) {
    double an = b / 2.0;
    ans += an;
  } else {
    double an = (b - n * 2);
    ans += n;
    ans += an;
  }
}
void sovel2() {
  long long int an = n / m;
  long long int bn = n % m;
  long long int all;
  if (bn == 0) {
    all = n * 2;
    ans = (double)(cnt / 2.0);
    return;
  } else {
    all = n * 2 + (m - bn);
    long long int xn = cnt / all;
    long long int yu = cnt % all;
    ans += (n + (m - bn)) * xn;
    if (yu <= n * 2) {
      ans += yu / 2.0;
      return;
    } else {
      ans += n;
      yu -= n * 2;
      ans += yu;
    }
  }
}
int main() {
  cin >> n >> m >> t;
  cnt = t * 2;
  if (n <= m) {
    sovel1();
  } else {
    sovel2();
  }
  printf("%.1lf\n", ans);
  return 0;
}
