#include <bits/stdc++.h>
using namespace std;
long long int modexp(long long int a, long long int n) {
  long long int r = 1;
  while (n) {
    if (n & 1) r = (r * a) % 1000000007;
    a = (a * a) % 1000000007;
    n >>= 1;
  }
  return r;
}
long long int f[1000000];
void solve() {
  long long int n, d, m, l;
  cin >> n >> d >> m >> l;
  vector<pair<long long int, long long int>> v;
  for (int k = 1; k < n + 1; k++) {
    v.push_back(make_pair((k - 1) * m, (k - 1) * m + l));
  }
  for (long long int i = 1; i < n; i++) {
    long long int x = v[i - 1].second, y = v[i].first;
    for (long long int j = x + 1; j < y; j++) {
      if (j % d == 0) {
        cout << j;
        return;
      }
    }
  }
  for (long long int i = (n - 1) * m + l + 1;; i++) {
    if (i % d == 0) {
      cout << i;
      return;
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
