Elevator

Time limit1sMemory limit128 MB

Problem

Donghyeok got a job at a company that builds the only elevator of its kind in the world. The moment he joined, he was put in charge of designing a new elevator for a building with $h$ floors.

After several sleepless nights, Donghyeok came up with an elevator that has only 4 buttons. Each button works as follows:

  1. Go up $a$ floors from the current floor.
  2. Go up $b$ floors from the current floor.
  3. Go up $c$ floors from the current floor.
  4. Return immediately to floor 1.

The elevator starts on floor 1. A passenger presses these buttons in any order, as many times as they wish, to reach a target floor. However, if pressing one of the "go up" buttons would move the elevator above floor $h$ (the top floor of the building), the elevator does not move.

To prove that his design is worthwhile, Donghyeok wants to count how many distinct floors this elevator can reach. (Floor 1, where the elevator starts, counts as reachable.)

Input

The first line contains the height of the building $h$. ($1 \le h \le 10^{18}$)

The second line contains three integers $a$, $b$, $c$ separated by spaces. ($1 \le a, b, c \le 100{,}000$)

Output

Print the number of distinct floors the elevator can reach.