import std.stdio; import std.algorithm; import std.string : chomp; import std.range; import std.conv; import std.numeric; void main(string[] args) { auto lcm(ulong a, ulong b) { return a * b / gcd(a, b); } immutable n = readln.chomp.to!int; auto input = readln.splitter.map!(to!int).array; ulong a = input[0], b = input[1], c = input[2]; writeln( n / a + n / b + n / c - n / lcm(a, b) - n / lcm(a, c) - n / lcm(b, c) + n / lcm(lcm(a, b), c) ); }