#include #include #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++) typedef long long int ll; int main( void ){ ll n, a, b; if (!scanf( "%lld %lld %lld", &n, &a, &b )) return 0; ll sum = 0; n--; sum += n / a + n / b + 2; ll gcd = std::__gcd( a, b ); sum -= ( n / a / b * std::__gcd( a, b )) + 1; printf( "%lld\n", sum ); return 0; }