n = read_line.to_i64 a, b, c = read_line.split.map &.to_i64 na = n // a nb = n // b nc = n // c nab = n // a.lcm(b) nbc = n // b.lcm(c) nca = n // c.lcm(a) nabc = n // a.lcm(b).lcm(c) ans = na + nb + nc - nab - nbc - nca + nabc puts ans