#include <iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include <random>
#define ll long long
using namespace std;
int main() {
ll n, x, y,n1,n2;
cin >> n >> x >> y;
n1 = n / x + 1;
n2 = n / y + 1;
n1 *= x;
n2 *= y;
cout << max(n1, n2);
}