FizzBuzz Sum Hard

AtCoder
IDabc253_d
Time2000ms
Memory256MB
Difficulty
Find the sum of integers between $1$ and $N$ (inclusive) that are not multiples of $A$ or $B$. ## Constraints * $1 \leq N, A,B \leq 10^9$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $N$ $A$ $B$ [samples]
Samples
Input #1
10 3 5
Output #1
22

The integers between $1$ and $10$ (inclusive) that are not multiples of $3$ or $5$ are $1,2,4,7$, and $8$, whose sum is $1+2+4+7+8 =22$.
Input #2
1000000000 314 159
Output #2
495273003954006262
API Response (JSON)
{
  "problem": {
    "name": "FizzBuzz Sum Hard",
    "description": {
      "content": "Find the sum of integers between $1$ and $N$ (inclusive) that are not multiples of $A$ or $B$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc253_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Find the sum of integers between $1$ and $N$ (inclusive) that are not multiples of $A$ or $B$.\n\n## Constraints\n\n*   $1 \\leq N, A,B \\leq 10^9$\n*   All values in input are integers.\n\n## Input\n\nInput is ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments