#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
template <typename T>
bool cmax(T &a, T b) {
  return (a < b) ? a = b, 1 : 0;
}
template <typename T>
bool cmin(T &a, T b) {
  return (a > b) ? a = b, 1 : 0;
}
template <typename T>
T read() {
  T ans = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch))
    ans = (ans << 3) + (ans << 1) + (ch - '0'), ch = getchar();
  return ans * f;
}
template <typename T>
void write(T x, char y) {
  if (x == 0) {
    putchar('0'), putchar(y);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  static char wr[20];
  int top = 0;
  for (; x; x /= 10) wr[++top] = x % 10 + '0';
  while (top) putchar(wr[top--]);
  putchar(y);
}
void file() {}
long long k, d, t;
void input() {
  k = read<long long>(), d = read<long long>(), t = read<long long>();
}
double ans;
long long tot, ever;
void work() {
  tot = 2 * t;
  long long num = k / d;
  if (k % d) num++;
  ever = num * d + k;
  ans += tot / ever * (d * num);
  long long res = tot - tot / ever * ever;
  if (k * 2 >= res)
    ans += 1.0 * res / 2.0;
  else
    ans += res - k;
  printf("%.6lf\n", ans);
}
int main() {
  file();
  input();
  work();
  return 0;
}
