题目描述
Problem Background
DJL, in order to avoid becoming a couch potato, comes to srwudi to learn the art of compressing code.
Problem Description
Srwudi's home is a skyscraper with $h$ floors. Due to the increasing number of novice visitors, srwudi has modified an elevator to make it easier for guests to go upstairs.
After the modification, srwudi's elevator can move in the following four ways:
- Move up by $x$ floors;
- Move up by $y$ floors;
- Move up by $z$ floors;
- Return to the first floor.
On a dark and windy afternoon, DJL arrives at srwudi's home. He is currently on the first floor, and coincidentally, the elevator is also on the first floor. DJL wants to know how many different floors he can reach using the elevator.
Input Format
The first line contains an integer $h$, representing the number of floors in the skyscraper.
The second line contains three positive integers, representing $x$, $y$, and $z$ respectively.
Output Format
A single line containing an integer, representing the number of different floors DJL can reach.
Sample Input and Output
Sample Input #1
15
4 7 9
Sample Output #1
9
Sample Input #2
33333333333
99005 99002 100000
Sample Output #2
33302114671
Notes
The reachable floors include: $1, 5, 8, 9, 10, 12, 13, 14, 15$.
$1 \le h \le 2^{63}-1$, $1 \le x, y, z \le 10^5$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分