#include <bits/stdc++.h>
int main() {
  long long n, d, m, l, i, le, ri, step;
  while (~scanf("%I64d%I64d%I64d%I64d", &n, &d, &m, &l)) {
    for (i = 0; i < n; i++) {
      le = i * m + l;
      ri = (i + 1) * m;
      step = (le + d) / d;
      if (step * d < ri) break;
    }
    printf("%I64d\n", step * d);
  }
}
