Under construction

Still being built. Things may change

Generalized FizzBuzz

Interview

Time limit1sMemory limit2048 MB

Summary
Given n, a, and b, count how many times Fizz, Buzz, and FizzBuzz are printed in a generalized FizzBuzz run from 1 to n.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

FizzBuzz is a common coding interview problem. The problem is as follows:

Given a positive integer nn, for all integers ii from 1 to nn, inclusive:

  • If ii is divisible by both 33 and 55, print "FizzBuzz".
  • Otherwise, if ii is divisible by 33, print "Fizz".
  • Otherwise, if ii is divisible by 55, print "Buzz".
  • Otherwise, print ii.

This problem uses a generalized version of FizzBuzz:

Given three positive integers nn, aa, and bb, for all integers ii from 1 to nn, inclusive:

  • If ii is divisible by both aa and bb, print "FizzBuzz".
  • Otherwise, if ii is divisible by aa, print "Fizz".
  • Otherwise, if ii is divisible by bb, print "Buzz".
  • Otherwise, print ii.

Given nn, aa, and bb, how many times are "Fizz", "Buzz", and "FizzBuzz" printed by a correct implementation?

Input

The first and only line of input contains three positive integers nn, aa, and bb (1≤n,a,b≤106)(1 \le n, a, b \le 10^6).

Output

Output three integers: the number of times "Fizz" is printed, the number of times "Buzz" is printed, and the number of times "FizzBuzz" is printed, in that order.

Examples2

  1. Example 1

    Input
    17 3 5
    
    Expected output
    4 2 1
    
  2. Example 2

    Input
    10 3 3
    
    Expected output
    0 0 3