#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d, m, l, left, right, ans, flag;
  cin >> n >> d >> m >> l;
  flag = 0;
  for (int i = 1; i <= n; i++) {
    left = (i - 1) * m + l;
    right = i * m;
    ans = (left + d) / d;
    if (ans * d < right) break;
  }
  cout << ans * d << endl;
  return 0;
}
