package main import ( "fmt" ) func main() { var n, a, b, c int fmt.Scan(&n, &a, &b, &c) na := n/a nb := n/b nc := n/c nab := n/lcm(a, b) nac := n/lcm(a,c) nbc := n/lcm(b,c) nabc := n/lcm(a,lcm(b,c)) fmt.Println(na+nb+nc-nab-nac-nbc+nabc) } func gcd(a, b int) int { if a < b { a, b = b, a } if b == 0 { return a } else { return gcd(b, a%b) } } func lcm(a, b int) int { return a * b / gcd(a, b) }