report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Elevator - MarisaOJ: Marisa Online Judge

Elevator

Time limit: 1000 ms
Memory limit: 256 MB
You are in an elevator of a skyscraper with $n$ floors. The elevator has four buttons - Go down to the first floor. - Go up by $A$ floors. - Go up by $B$ floors. - Go up by $C$ floors. You have observed that there are certain floors that cannot be reached from the first floor. Your goal is to determine the count of floors that can be reached from the first floor. ### Input - A single line contains four integers $n, A, B, C$. ### Output - Print an integer, the number of reachable floors. ### Constraints - $1 \le n \le 10^{18}$. - $1 \le A, B, C \le 10^5$. ### Example Input: ``` 10 2 6 9 ``` Output: ``` 6 ```
Shortest path
Shortest path
Delete edge
3D path
Number of shortest paths
Double edge
Second shortest path
Bye bye maximum edge
Boardgame
Teleport
?
Math
Festival 3
Arbitrage
Festival 4
String construction
Bye bye maximum edge 2
Elevator
Holiday
Fortress defense
Topic
Graph
Shortest path
Rating 2000
Solution (1) Solution