#include <bits/stdc++.h>
int n, m, d, l;
long long L, R;
int main() {
  scanf("%d%d%d%d", &n, &d, &m, &l);
  for (int i = 1; i <= n; i++) {
    L = l + 1ll * (i - 1) * m, R = 1ll * i * m - 1;
    if (L / d != R / d) break;
  }
  printf("%I64d\n", L / d * d + d);
}
