package main import ( "fmt" "os" "bufio" "strings" "strconv" ) type Scanner struct { reader *bufio.Reader buffer []string pointer int } func NewScanner() *Scanner { return &Scanner{ reader: bufio.NewReaderSize(os.Stdin,4096), pointer: 0, } } func (self *Scanner) NextLine () string { var buffer []byte for { line,isPrefix,_ := self.reader.ReadLine() buffer = append(buffer, line...) if !isPrefix { break } } return string(buffer) } func (self *Scanner) Next () string { if self.pointer >= len(self.buffer) { line := self.NextLine() self.buffer = strings.Fields(line) self.pointer = 0 } self.pointer++ return self.buffer[self.pointer-1] } func (self *Scanner) NextInt () int { s := self.Next() i,_ := strconv.ParseInt(s,10,32) return int(i) } func (self *Scanner) NextLong () int64{ s := self.Next() l,_ := strconv.ParseInt(s,10,64) return int64(l) } func (self *Scanner) NextFloat () float32 { s := self.Next() f,_ := strconv.ParseFloat(s,32) return float32(f) } func (self *Scanner) NextDouble () float64 { s := self.Next() d,_ := strconv.ParseFloat(s,64) return float64(d) } func modpow(x,y,mod int64) int64 { if y == 0 { return int64(1) } if y % 2 == 1 { return modpow(x,y-1,mod) * x % mod } tmp := modpow(x,y/2,mod) return tmp * tmp % mod } func main () { cin := NewScanner() N := cin.NextLong() tmpN := N modThree := int64(0) modFive := int64(0) cnt := int64(0) for N > 0 { modThree += N % 10 * modpow(4,cnt,3) modThree %= 3 modFive += N % 10 * modpow(4,cnt,5) modFive %= 5 N /= 10 cnt++ } if modThree == 0 && modFive == 0 { fmt.Println("FizzBuzz") } else if modFive == 0 { fmt.Println("Buzz") } else if modThree == 0 { fmt.Println("Fizz") } else { fmt.Println(tmpN) } }