package main import . "fmt" func main() { var h,a int64 Scan(&h,&a) var x,y int64 y=1 for h>0 { x+=y h/=a y*=2 } Println(x) }