package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var str string
		var n, k int
		fmt.Fscan(in, &n, &k, &str)
		ans, dis := 0, k
		for _, s := range str {
			if s == '0' {
				dis++
			} else {
				dis = 0
			}
			if dis == 2*k+1 {
				ans++
				dis = k
			}
		}
		if dis >= k+1 {
			ans++
		}
		fmt.Fprintln(out, ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input *bufio.Reader

func main() {
	var T int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscanln(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var (
		n, k int
		s string
	)
	fmt.Fscanln(input, &n, &k)
	fmt.Fscanln(input, &s)

	segs := make([]int, 0)
	l := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '1' {
			segs = append(segs, l)
			l = 0
		} else {
			l++
		}
	}
	segs = append(segs, l)
	//fmt.Println("segs:", segs)
	ans := 0
	for i := 0; i < len(segs); i++ {
		if segs[i] == 0 {continue}
		if i == 0 && i == len(segs) - 1 {
			ans += segs[i] / (k + 1)
			if segs[i] % (k + 1) > 0 {ans++}
		} else if i == 0 || i == len(segs) - 1 {
			segs[i] -= k
			if segs[i] > 0 {
				ans += segs[i] / (k + 1)
				if segs[i]  % (k + 1) > 0 {ans++}
			}
		} else {
			segs[i] -= 2*k
			if segs[i] > 0 {
				ans += segs[i] / (k + 1)
				if segs[i] % (k + 1) > 0 {ans++}
			}
		}
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n, k int
		fmt.Fscan(in, &n, &k)
		var x string
		tables := 0
		kCount := 0
		fmt.Fscan(in, &x)
		for j := 0; j < n; j++ {
			if x[j] == '0' && kCount == 0 {
				tables++
				kCount = k
			} else if x[j] == '0' && kCount > 0 {
				kCount--
			}
			if x[j] == '1' && kCount > 0 {
				tables--
				kCount = k
			} else if x[j] == '1' && kCount == 0 {
				kCount = k
			}
		}
		fmt.Println(tables)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.ParseInt(nks[0], 10, 64)
		k, _ := strconv.ParseInt(nks[1], 10, 64)
		line = readLine(reader)
		for j := int64(0); j < n; j++ {
			if line[j] == '1' {
				m := int64(0)
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m - 1
			}
		}
		sum := int64(0)
		for j := int64(0); j < n; j++ {
			if line[j] == '0' {
				sum++
				m := j + 1
				for ; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m - 1
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var s string

func nextPoint(p int) int {
	for i := p; i < len(s); i++ {
		if s[i] == '1' {
			return i
		}
	}

	return len(s)
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	var t, n, k int

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {

		fmt.Fscanf(reader, "%d %d\n%s\n", &n, &k, &s)
		sum := 0
		p := nextPoint(0)

		for i := 0; i < n; {
			if s[i] == '1' {
				i += (k + 1)
				continue
			}

			if i >= p {
				p = nextPoint(i + 1)
			}

			if p-i > k || p == n {
				i += (k + 1)
				sum++
			} else {
				i++
			}
		}

		fmt.Println(sum)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var s string

func main() {
	reader := bufio.NewReader(os.Stdin)

	var t, n, k int

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {

		fmt.Fscanf(reader, "%d %d\n%s\n", &n, &k, &s)
		d := make([]int, n+1)
		for i := 1; i < n; i++ {
			if s[i] == '1' || s[i-1] == '1' {
				d[i] = i
			} else {
				d[i] = d[i-1]
			}
		}

		if s[n-1] == '1' {
			d[n] = d[n-1] + 1
		} else {
			d[n] = d[n-1]
		}

		sum := 0
		var i, left, right int
		for i = 0; i <= k && i < n; {
			if s[i] == '1' {
				i += (k + 1)
				continue
			}

			if i+k >= n {
				right = d[n]
			} else {
				right = d[i+k]
			}

			if d[i] == right {
				sum++
				i += (k + 1)
			} else {
				i++
			}
		}

		for i < n {
			if s[i] == '1' {
				i += (k + 1)
				continue
			}

			left = d[i-k]

			if i+k >= n {
				right = d[n-1]
			} else {
				right = d[i+k]
			}

			if left == right {
				sum++
				i += (k + 1)
			} else {
				i++
			}
		}

		fmt.Println(sum)
	}
}

/*
URL:
https://codeforces.com/problemset/problem/1367/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t    int
	n, k int
	S    []rune
)

func main() {
	t = ReadInt()

	for i := 0; i < t; i++ {
		n, k = ReadInt2()
		S = ReadRuneSlice()

		solve()
	}
}

func solve() {
	memo := make([]bool, n)
	for i := 0; i < n; i++ {
		// if S[i] == '1' {
		// 	if i-1 >= 0 {
		// 		memo[i-1] = true
		// 	}
		// 	memo[i] = true
		// 	if i+1 < n {
		// 		memo[i+1] = true
		// 	}
		// }
		if S[i] == '1' {
			for j := i - k; j <= i+k; j++ {
				if 0 <= j && j < n {
					memo[j] = true
				}
			}
		}
	}

	comp, cnts := RunLengthEncoding(memo)

	ans := 0
	for i := 0; i < len(comp); i++ {
		if !comp[i] {
			ans += Kiriage(cnts[i], k+1)
		}
	}
	fmt.Println(ans)
}

// Kiriage returns Ceil(a/b)
// a >= 0, b > 0
func Kiriage(a, b int) int {
	return (a + (b - 1)) / b
}

// RunLengthEncoding returns encoded slice of an input.
func RunLengthEncoding(S []bool) ([]bool, []int) {
	runes := []bool{}
	lengths := []int{}

	l := 0
	for i := 0; i < len(S); i++ {
		// 1文字目の場合保持
		if i == 0 {
			l = 1
			continue
		}

		if S[i-1] == S[i] {
			// 直前の文字と一致していればインクリメント
			l++
		} else {
			// 不一致のタイミングで追加し、長さをリセットする
			runes = append(runes, S[i-1])
			lengths = append(lengths, l)
			l = 1
		}
	}
	runes = append(runes, S[len(S)-1])
	lengths = append(lengths, l)

	return runes, lengths
}

// RunLengthDecoding decodes RLE results.
func RunLengthDecoding(S []bool, L []int) []bool {
	if len(S) != len(L) {
		panic("S, L are not RunLengthEncoding results")
	}

	res := []bool{}

	for i := 0; i < len(S); i++ {
		for j := 0; j < L[i]; j++ {
			res = append(res, S[i])
		}
	}

	return res
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var n, k, nTest int
var s string

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)

	fmt.Fscan(in, &nTest)
	for t := 0; t < nTest; t++ {
		fmt.Fscan(in, &n, &k)
		fmt.Fscan(in, &s)
		res := 0

		dis := k
		for i := 0; i < n+k; i++ {
			if i >= n || s[i] == '0' {
				dis++
			} else {
				dis = 0
			}

			if dis == 2*k+1 {
				res++
				dis = k
			}
		}
		fmt.Fprintln(out, res)
	}

	out.Flush()
}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, k int
	var s []byte
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k, &s)
		c, p := 0, -1
		for i, b := range s {
			if b == '0' && (p == -1 || i-p > k) {
				c++
				p = i
			} else if b == '1' {
				if p >= 0 && s[p] == '0' && i-p <= k {
					c--
				}
				p = i
			}
		}
		Fprintln(out, c)
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1367C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var t, n, k int
	var s []byte
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k, &s)
		c, p := 0, -1
		for i, b := range s {
			if b == '0' && (p == -1 || i-p > k) {
				c++
				p = i
			} else if b == '1' {
				if p >= 0 && s[p] == '0' && i-p <= k {
					c--
				}
				p = i
			}
		}
		Fprintln(out, c)
	}
}

func main() { CF1367C(os.Stdin, os.Stdout) }

package main

import (
  "fmt"
)

var t int
func main() {
  fmt.Scan(&t)
  for i := 0; i < t; i++ {
    var n, k int
    fmt.Scan(&n, &k)
    var tables []byte
    fmt.Scan(&tables)
    last := -1
    var startFromZero bool
    if tables[0] == '0' {
      startFromZero = true
    } else {
      startFromZero = false
    }
    ans := 0
    for j := range tables {
      var available int
      if tables[j] == '1' {
        if startFromZero {
          available = (j-1)-last
          startFromZero = false
          if available > 0 {
          	ans += available / (k+1)
          }
        } else {
          available = ((j-1)-last-2*k)
          if available > 0 {
          	ans++
          	available--
          	ans += available / (k+1)
          }
        }
        last = j
      } else if j == n-1 {
        if startFromZero {
          available = n
        } else {
          available = j-last-k
        }
        if available > 0 {
          ans++
          available--
          ans += available / (k+1)
        }
      }
    }
    fmt.Println(ans)
  }

}

package main

import (
	"fmt"
	"math"
	"strings"
)

var (
	tests = 0
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k+1,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	fmt.Scanf("%d\n", &tests)

	for ; tests > 0; tests-- {
		var n int
		var k int
		var s string

		fmt.Scan(&n)
		fmt.Scan(&k)
		fmt.Scan(&s)
		//fmt.Println("xxx", n, k, s)
		process(n, k, s)
	}
}

package main

import "fmt"

func main() {
    var CASE int
    fmt.Scanf("%d\r\n",&CASE)
    for K := 0;K < CASE;K++ {
        var n,k int
        fmt.Scan(&n,&k)
        var s string
        fmt.Scan(&s)
        res := 0
        //fmt.Print(s)
        last := -1
        cnt := 0

        for i := 0;i < n + 1;i++ {
            if i == n || s[i] == '1' {
                if last == -1 && i == n {
                    res += (cnt - 1) / (k + 1) + 1
                } else if last == -1 || i == n {
                    res += cnt / (k + 1)
                    if cnt % (k + 1) != 0 {
                        //res++
                    }
                } else {
                    res += (cnt - k) / (k + 1)
                }
                last = i
                cnt = 0
            } else {
                cnt++
            }
        }

        fmt.Printf("%d\n",res)
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)

		s, _ := reader.ReadString('\n')

		fmt.Println(solve(n, k, s[:n]))
	}
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n, k int, s string) int {
	var j int
	if s[0] == '1' {
		j++
	}

	var res int
	for i := 0; i < n; {
		j := i + 1

		for j < n && s[j] != '1' {
			j++
		}

		var left, right int
		if s[i] == '1' {
			left = k
		}
		if j < n && s[j] == '1' {
			right = k
		}

		d := j - i

		if left == k {
			d--
		}

		d -= left + right

		if d > 0 {
			res += (d + k) / (k + 1)
		}

		i = j
	}

	return res
}

package main

import (
	"fmt"
	"io"
	"math"
	"os"
	"strings"
)

var (
	debug = false
	tests = 0
	reader io.Reader
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k+1,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	if debug {
		var e error
		reader, e = os.Open("input.txt")
		if e != nil {
			fmt.Println("error", e.Error())
			return
		}
	} else {
		reader = os.Stdin
	}

	fmt.Scanf("%d", &tests)

	for ; tests > 0; tests-- {
		var n int
		var k int
		var s string

		fmt.Scanf("%d %d", &n, &k)
		fmt.Scan(&s)
		process(n, k, s)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var s string

func main() {
	reader := bufio.NewReader(os.Stdin)

	var t, n, k int

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {

		fmt.Fscanf(reader, "%d %d\n%s\n", &n, &k, &s)
		d := make([]int, n)
		for i := 1; i < n; i++ {
			if s[i] == '1' || s[i-1] == '1' {
				d[i] = i
			} else {
				d[i] = d[i-1]
			}
		}

		sum := 0
		var i, left, right int
		for i = 0; i <= k; {

			if i+k >= n {
				right = d[n-1]
			} else {
				right = d[i+k]
			}

			if d[i] == right {
				sum++
				i += (k + 1)
			} else {
				i++
			}
		}

		for i < n {
			left = d[i-k]

			if i+k >= n {
				right = d[n-1]
			} else {
				right = d[i+k]
			}

			if left == right {
				sum++
				i += (k + 1)
			} else {
				i++
			}
		}

		fmt.Println(sum)
	}
}

package main

import (
  "fmt"
)

var t int
func main() {
  fmt.Scan(&t)
  for i := 0; i < t; i++ {
    var n, k int
    fmt.Scan(&n, &k)
    var tables []byte
    fmt.Scan(&tables)
    last := -1
    var startFromZero bool
    if tables[0] == '0' {
      startFromZero = true
    } else {
      startFromZero = false
    }
    ans := 0
    for j := range tables {
      var available int
      if tables[j] == '1' {
        if startFromZero {
          available = (j-1)-last
          startFromZero = false
        } else {
          available = ((j-1)-last-2*k)
        }
        if available > 0 {
          ans++
          available--
          ans += available / (k+1)
        }
        last = j
      } else if j == n-1 {
        if startFromZero {
          available = n
        } else {
          available = j-last-k
        }
        if available > 0 {
          ans++
          available--
          ans += available / (k+1)
        }
      }
    }
    fmt.Println(ans)
  }

}

package main

import "fmt"

func main() {
    var CASE int
    fmt.Scanf("%d\r\n",&CASE)
    for K := 0;K < CASE;K++ {
        var n,k int
        fmt.Scan(&n,&k)
        var s string
        fmt.Scan(&s)
        last := -k - 1
        res := 0
        //fmt.Print(s)
        for i := 0;i < n;i++ {
            if s[i] == '1' {
                dist := i - last - k
                if dist > k {
                    res += dist / (k + 1)
                }

                last = i
            }
        }
        now := n + k - 1
        dist := now - last - k
        if dist > k {
            res += dist / (k + 1)
        }
        fmt.Printf("%d\n",res)
    }
}

package main

import "fmt"

func main() {
    var CASE int
    fmt.Scanf("%d\r\n",&CASE)
    for K := 0;K < CASE;K++ {
        var n,k int
        fmt.Scan(&n,&k)
        var ss string
        fmt.Scan(&ss)
        s := []rune(ss)
        s = append(s,'1')
        last := -k - 1
        res := 0
        //fmt.Print(s)
        for i := 0;i < n + 1;i++ {
            if s[i] == '1' {
                dist := i - last - k
                if dist > k {
                    res += dist / (k + 1)
                }

                last = i
            }
        }
        fmt.Printf("%d\n",res)
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)

		s, _ := reader.ReadString('\n')

		fmt.Println(solve(n, k, s[:n]))
	}
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n, k int, s string) int {
	var j int
	if s[0] == '1' {
		j++
	}

	var res int
	for i := j + 1; i <= n; i++ {
		if i < n && s[i] == '0' {
			continue
		}
		// i == n or s[i] == '1'
		d := i - j

		if j == 0 && i == n {
			//x12x12x12..x
			res = (d + k) / (k + 1)
			break
		}
		//12k12k12k12
		//k12k1
		var x = d / (k + 1)
		r := d % (k + 1)

		if x > 0 {
			if j == 0 {
				// i < n
				if r != 0 {
					x--
				}
			} else {
				// j > 0
				if i < n && r != k {
					x--
				}
			}
		}
		res += x
		j = i + 1
	}

	return res
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)

		s, _ := reader.ReadString('\n')

		fmt.Println(solve(n, k, s[:n]))
	}
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n, k int, s string) int {
	var j int
	if s[0] == '1' {
		j++
	}

	var res int
	for i := j + 1; i <= n; i++ {
		if i < n && s[i] == '0' {
			continue
		}
		// i == n or s[i] == '1'
		d := i - j

		if j == 0 && i == n {
			//x12x12x12..x
			res = (d + k) / (k + 1)
			break
		}
		//12k12k12k12
		//k12k1
		var x = d / (k + 1)
		r := d % (k + 1)

		if j == 0 {
			// i < n
			if r != 0 {
				x--
			}
		} else {
			// j > 0
			if i < n && r != k {
				x--
			}
		}

		res += x
		j = i + 1
	}

	return res
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.ParseInt(nks[0], 10, 64)
		k, _ := strconv.ParseInt(nks[1], 10, 64)
		line = readLine(reader)
		for j := int64(0); j < n; j++ {
			if line[j] == '1' {
				m := int64(0)
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						m--
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		sum := int64(0)
		for j := int64(0); j < n; j++ {
			if line[j] == '0' {
				sum++
				m := j + 1
				for ;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.Atoi(nks[0])
		k, _ := strconv.Atoi(nks[1])
		line = readLine(reader)
		for j := 0; j < n; j++ {
			if line[j] == '1' {
				for m := j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m := j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
			}
		}
		sum := 0
		for j := 0; j < n; j++ {
			if line[j] == '0' {
				sum++
				for m:=j+1;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.ParseInt(nks[0], 10, 64)
		k, _ := strconv.ParseInt(nks[1], 10, 64)
		line = readLine(reader)
		for j := int64(0); j < n; j++ {
			if line[j] == '1' {
				m := int64(0)
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		sum := 0
		for j := int64(0); j < n; j++ {
			if line[j] == '0' {
				sum++
				m := j + 1
				for ;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.ParseInt(nks[0], 10, 64)
		k, _ := strconv.ParseInt(nks[1], 10, 64)
		line = readLine(reader)
		for j := int64(0); j < n; j++ {
			if line[j] == '1' {
				m := int64(0)
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m - 1
			}
		}
		sum := int64(0)
		for j := int64(0); j < n; j++ {
			if line[j] == '0' {
				sum++
				m := j + 1
				for ;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.Atoi(nks[0])
		k, _ := strconv.Atoi(nks[1])
		line = readLine(reader)
		for j := 0; j < n; j++ {
			if line[j] == '1' {
				m := 0
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		sum := 0
		for j := 0; j < n; j++ {
			if line[j] == '0' {
				sum++
				for m:=j+1;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.Atoi(nks[0])
		k, _ := strconv.Atoi(nks[1])
		line = readLine(reader)
		for j := 0; j < n; j++ {
			if line[j] == '1' {
				m := 0
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		sum := 0
		for j := 0; j < n; j++ {
			if line[j] == '0' {
				sum++
				m := j + 1
				for ;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		nks := strings.Split(string(line), " ")
		n, _ := strconv.ParseInt(nks[0], 10, 64)
		k, _ := strconv.ParseInt(nks[1], 10, 64)
		line = readLine(reader)
		for j := int64(0); j < n; j++ {
			if line[j] == '1' {
				m := int64(0)
				for m = j - 1; m >= j-k && m >= 0; m-- {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				for m = j + 1; m <= j+k && m < n; m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		sum := int64(0)
		for j := int64(0); j < n; j++ {
			if line[j] == '0' {
				sum++
				m := j + 1
				for ;m<=j+k&&m<n;m++ {
					if line[m] == '1' {
						break
					}
					line[m] = '1'
				}
				j = m
			}
		}
		fmt.Println(sum)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var n, k, nTest int
var s string

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)

	fmt.Fscan(in, &nTest)
	for t := 0; t < nTest; t++ {
		fmt.Fscan(in, &n, &k)
		fmt.Fscan(in, &s)
		res := 0

		dis := k
		for i := 0; i < n+k; i++ {
			if i >= n || s[i] == '0' {
				dis++
			}

			if (i < n && s[i] == '1') || (i == n+k-1) {
				res += dis / (2*k + 1)
				dis = 0
			}

		}
		fmt.Fprintln(out, res)
	}

	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	debug = false
	tests = 0
	reader io.Reader
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	return int(math.Ceil(float64(n - count * (k + 1))/float64(k+1)))
	//
	//if !strings.Contains(s, "1") {
	//	return int(math.Ceil(float64(n)/float64(k+1)))
	//}
	//
	//
	//if s[0] == '1' && s[n-1] == '1' {
	//	return int(math.Ceil(float64(n-2*k)/float64(k+1)))
	//}
	//
	//return int(math.Ceil(float64(n-k)/float64(k+1)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k, s[start:i+1]))
			total += cal(i-start+1, k, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		total += cal(n-start, k, s[start:])
	}

	fmt.Println(total)
}

func input() {
	if debug {
		var e error
		reader, e = os.Open("input.txt")
		if e != nil {
			fmt.Println("error", e.Error())
			return
		}
	} else {
		reader = os.Stdin
	}

	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	if scanner.Scan() {
		tests = parseInt(scanner.Text())
	}

	for ; tests > 0; tests-- {
		scanner.Scan()
		n := parseInt(scanner.Text())
		scanner.Scan()
		k := parseInt(scanner.Text())
		scanner.Scan()
		s := scanner.Text()

		process(n, k, s)
	}
}

func parseInt(text string) int {
	result, _ := strconv.Atoi(text)
	return result
}

package main

import (
	"fmt"
	"math"
	"strings"
)

var (
	tests = 0
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k+1,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	fmt.Scanf("%d\n", &tests)

	for ; tests > 0; tests-- {
		var n int
		var k int
		var s string

		fmt.Scanf("%d %d\n", &n, &k)
		fmt.Scanf("%s", &s)
		process(n, k, s)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	debug = false
	tests = 0
	reader io.Reader
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
	//
	//if !strings.Contains(s, "1") {
	//	return int(math.Ceil(float64(n)/float64(k+1)))
	//}
	//
	//
	//if s[0] == '1' && s[n-1] == '1' {
	//	return int(math.Ceil(float64(n-2*k)/float64(k+1)))
	//}
	//
	//return int(math.Ceil(float64(n-k)/float64(k+1)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k+1,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	if debug {
		var e error
		reader, e = os.Open("input.txt")
		if e != nil {
			fmt.Println("error", e.Error())
			return
		}
	} else {
		reader = os.Stdin
	}

	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	if scanner.Scan() {
		tests = parseInt(scanner.Text())
	}

	for ; tests > 0; tests-- {
		scanner.Scan()
		n := parseInt(scanner.Text())
		scanner.Scan()
		k := parseInt(scanner.Text())
		scanner.Scan()
		s := scanner.Text()

		process(n, k, s)
	}
}

func parseInt(text string) int {
	result, _ := strconv.Atoi(text)
	return result
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	debug = false
	tests = 0
	reader io.Reader
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
	//
	//if !strings.Contains(s, "1") {
	//	return int(math.Ceil(float64(n)/float64(k+1)))
	//}
	//
	//
	//if s[0] == '1' && s[n-1] == '1' {
	//	return int(math.Ceil(float64(n-2*k)/float64(k+1)))
	//}
	//
	//return int(math.Ceil(float64(n-k)/float64(k+1)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	if debug {
		var e error
		reader, e = os.Open("input.txt")
		if e != nil {
			fmt.Println("error", e.Error())
			return
		}
	} else {
		reader = os.Stdin
	}

	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	if scanner.Scan() {
		tests = parseInt(scanner.Text())
	}

	for ; tests > 0; tests-- {
		scanner.Scan()
		n := parseInt(scanner.Text())
		scanner.Scan()
		k := parseInt(scanner.Text())
		scanner.Scan()
		s := scanner.Text()

		process(n, k, s)
	}
}

func parseInt(text string) int {
	result, _ := strconv.Atoi(text)
	return result
}

package main

import (
	"fmt"
	"math"
	"strings"
)

var (
	tests = 0
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k+1,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	fmt.Scanf("%d", &tests)

	for ; tests > 0; tests-- {
		var n int
		var k int
		var s string

		fmt.Scanf("%d %d", &n, &k)
		fmt.Scan(&s)
		process(n, k, s)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	debug = false
	tests = 0
	reader io.Reader
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	return int(math.Ceil(float64(n - count * (k + 1))/float64(k+1)))
	//
	//if !strings.Contains(s, "1") {
	//	return int(math.Ceil(float64(n)/float64(k+1)))
	//}
	//
	//
	//if s[0] == '1' && s[n-1] == '1' {
	//	return int(math.Ceil(float64(n-2*k)/float64(k+1)))
	//}
	//
	//return int(math.Ceil(float64(n-k)/float64(k+1)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k, s[start:i+1]))
			total += cal(i-start+1, k, s[start:i+1])
			start = i
		}
	}

	fmt.Println(total)
}

func input() {
	if debug {
		var e error
		reader, e = os.Open("input.txt")
		if e != nil {
			fmt.Println("error", e.Error())
			return
		}
	} else {
		reader = os.Stdin
	}

	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	if scanner.Scan() {
		tests = parseInt(scanner.Text())
	}

	for ; tests > 0; tests-- {
		scanner.Scan()
		n := parseInt(scanner.Text())
		scanner.Scan()
		k := parseInt(scanner.Text())
		scanner.Scan()
		s := scanner.Text()

		process(n, k, s)
	}
}

func parseInt(text string) int {
	result, _ := strconv.Atoi(text)
	return result
}

package main

import (
	"fmt"
	"math"
	"strings"
)

var (
	tests = 0
)

func main() {
	input()
}

func cal(n int, k int, s string) int {
	if n < 1 || s == "1" {
		return 0
	}

	if s == "0" {
		return 1
	}

	count := strings.Count(s, "1")
	if n - count * k <= 0 {
		return 0
	}

	return int(math.Ceil(float64(n - count * k)/float64(k)))
}

func process(n int, k int, s string) {
	if !strings.Contains(s, "1") {
		fmt.Println(cal(n,k+1,s))
		return
	}

	start := 0
	total := 0
	for i := 0; i < n; i++ {
		if s[i] == '1' {
			//fmt.Println("xxx", i-start+1, s[start:i+1], cal(i-start+1, k + 1, s[start:i+1]))
			total += cal(i-start+1, k + 1, s[start:i+1])
			start = i
		}
	}

	if s[n-1] == '0' {
		//fmt.Println("xxx", n-start, s[start:], cal(n-start, k + 1, s[start:]))
		total += cal(n-start, k + 1, s[start:])
	}

	fmt.Println(total)
}

func input() {
	fmt.Scanf("%d\n", &tests)

	for ; tests > 1; tests-- {
		var n int
		var k int
		var s string

		fmt.Scanf("%d %d\n", &n, &k)
		fmt.Scanf("%s\n", &s)
		process(n, k, s)
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, k := 0, 0
		fmt.Fscan(in, &n, &k)
		// ans = k + # of skips till k
		// skip = an integer div by n
		skip := (k - 1) / (n - 1)
		fmt.Fprintln(out, k+skip)
	}
}

package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

func CheckError(err error) {
  if err != nil {
    panic(err)
  }
}

func Assert(b bool) {
  if !b {
    panic("Assertion error")
  }
}

func main() {
  input := os.Stdin
  /*
  input := strings.NewReader(`6
3 7
4 12
2 1000000000
7 97
1000000000 1000000000
2 1
`)
  */
  scanner := bufio.NewScanner(input)

  getLine := func() string {
    if !scanner.Scan() {
      panic("expected line")
    }
    return scanner.Text()
  }

  parseNumber := func(s string) int {
    t, err := strconv.ParseInt(s, 10, 64)
    CheckError(err)
    return int(t)
  }

  getNumber := func() int {
    return parseNumber(getLine())
  }

  t := getNumber()
  for i := 0; i < t; i++ {
    lst := strings.Split(getLine(), " ")
    n := parseNumber(lst[0])
    k := parseNumber(lst[1])

    //fmt.Println(n, k)
    processPair(n, k)
  }

}

func processPair(n, k int) {
  p := k / (n - 1)
  q := k % (n - 1)

  var x int
  if q == 0 {
    x = n*p - 1
  } else {
    x = n*p + q
  }

  fmt.Println(x)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	t := scanInt()
	for ; t > 0; t-- {
		n , k := scanInt(), scanInt()
		x := k / (n - 1)
		if k % (n - 1) == 0 {
			_, _ = printFmt(n*x - 1)
		} else {
			_, _ = printFmt(n*x + k % (n-1))
		}
	}
}
/*********************** I/O ***********************/

var channelType chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var printFmt func(a ...interface{}) (n int, err error)

func init() {
	printFmt = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	channelType = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range channelType {
			_, _ = writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; return s}
func scanIntSlice(n int) []int {arr := make([]int, n); for i := 0; i < n; i++ {arr[i] = scanInt()}; return arr}
func scanInt64Slice(n int) []int64 {arr := make([]int64, n); for i := 0; i < n; i++ {arr[i] = scanInt64()}; return arr}

/*********************** Utils ***********************/

func stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(a []int) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.Itoa(a[i]) + " ")}; return sb.String()}
func spaceSeperatedStringFromArray64(a []int64) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.FormatInt(a[i], 10) + " ")}; return sb.String()}
func minMaxFromArray(args ...int64) (int64, int64) {minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64); for _, v := range args {if v < minVal {minVal = v}; if v > maxVal {maxVal = v}}; return minVal, maxVal}
func minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if a == 0 {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := MnMx(args...); return mn }
func max(args ...int) int { _, mx := MnMx(args...); return mx }
func MnMx(args ...int) (int, int) {
	minVal, maxVal := math.MaxInt32, math.MinInt32
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n, k int64
		fmt.Scanf("%d %d\n", &n, &k)
		q := k / (n - 1)
		r := k % (n - 1)
		if r == 0 {
			fmt.Println(q*n - 1)
		} else {
			fmt.Println(q*n + r)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	s := NewScanner()
	t := s.NextInt()

	for i := 0; i < t; i++ {
		n, k := s.NextInt(), s.NextInt()
		if n > k {
			fmt.Println(k)
		} else {
			v := n*(k/(n-1)) + k%(n-1)
			if v%n == 0 {
				v--
			}
			fmt.Println(v)
		}
	}
}

type scanner struct {
	*bufio.Scanner
}

func NewScanner() *scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &scanner{s}
}

func (s *scanner) NextInt() int {
	s.Scan()
	i, _ := strconv.Atoi(s.Text())
	return i
}

func (s *scanner) NextInt64() int64 {
	s.Scan()
	i, _ := strconv.ParseInt(s.Text(), 10, 64)
	return i
}

func (s *scanner) NextString() string {
	s.Scan()
	return s.Text()
}

// https://codeforces.com/contest/1352/problem/C
package main

import (
	"bufio"
	"fmt"
	"os"
	"io"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var n, k int
	fmt.Fscan(input, &n, &k)
	if k < n {
		fmt.Println(k)
	} else {
		r := k % (n - 1)
		g := k / (n - 1)
		kn := g * n
		ans := kn + r
		if r == 0 {
			ans--
		}

		fmt.Println(ans)
	}

}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		var n, k int
		fmt.Scan(&n, &k)
		// find the k-th positive integer not divisible by n
		m := k + (k-1)/(n-1)
		fmt.Println(m)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"

)
func max(a,b int) int{
	if(a>b){
		return a
	}
	return b;
}
func main(){
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var T int;
	fmt.Fscanln(reader, &T)
	for t:=0;t<T;t++ {
		var n,k int;
		fmt.Fscanln(reader,&n,&k)
		countsEveryItteration := n-1
		multiples := k/countsEveryItteration
		if(k%countsEveryItteration==0){
			fmt.Fprintln(writer,n*multiples-1)
			continue
		}
		startValue := n*multiples
		startItterations := countsEveryItteration*multiples
		diff:= k -startItterations
		fmt.Fprintln(writer,startValue+diff)
	}
}

package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()

	t := scanner.Text()

	testCases, err := strconv.Atoi(t)

	if err != nil {
		panic(err)
	}

	for j := 0; j < int(testCases); j ++ {

		scanner.Scan()

		nk := scanner.Text()

		parts := strings.Fields(nk)

		nn := parts[0]
		kk := parts[1]

		n, _  := strconv.Atoi(nn)

		k, _  := strconv.Atoi(kk)

		res := solve2(n, k)

		fmt.Println(res)
	}
}

func solve2(n , k int) int {
	q := k / (n - 1)

	a := q * n

	b := a - q

	s := k - b

	if s == 0 {
		return  a - 1
	}

	return s + a
}

/*
URL:
https://codeforces.com/contest/1352/problem/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t    int
	n, k int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k = ReadInt2()
		solve(int64(n), int64(k))
	}
}

func solve(n, k int64) {
	var ans int64

	c := k / (n - 1)
	nokori := k - (n-1)*c

	if nokori == 0 {
		ans = n*c - 1
	} else {
		ans = n*c + nokori
	}

	fmt.Println(ans)
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		n := readInt()
		k := readInt()
		a := int64(k / (n - 1))

		a2 := int64(k % (n - 1))
		start := (int64(n) * a) + a2
		if a2 == 0 {
			start--
		}
		fmt.Println(start)
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func CF1352C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var t, n, k int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k)
		ans := sort.Search(2.1e9, func(x int) bool { return x-x/n >= k })
		Fprintln(out, ans)
	}
}

func main() { CF1352C(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

var DEBUG = true

func main() {
	defer Flush()

	T := readi()
	for t := 0; t < T; t++ {
		n := readi()
		k := readi()
		println(solve(n, k))
	}

}

func solve(n, k int) int {
	x := (k - 1) / (n - 1)
	return x*n + (k-1)%(n-1) + 1
}

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func dbgf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func dbg(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	t := nextInt()
	for i := 0; i < t; i++ {
		n, k := nextInt(), nextInt()
		if k < n-1 {
			fmt.Println(k)
			continue
		}
		if k%(n-1) == 0 {
			fmt.Println(k/(n-1)*n - 1)
			continue
		} else if k%(n-1) > 0 {
			fmt.Println(int(k/(n-1))*n + k%(n-1))
			continue
		}
	}

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}

// https://serhatgiydiren.github.io

package main

import "fmt"
import "os"
import "bufio"

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func solve(test_id int) {
 var n, k int
 fmt.Fscanf(reader, "%d %d\n", &n, &k)
 fmt.Fprintf(writer,"%d\n", (k-1) / (n-1) + k)
}

func solve_cases() {
 defer writer.Flush()
 t := 1
 fmt.Fscanf(reader, "%d\n", &t)
 for i := 0 ; i < t ; i++ {
  solve(i)
 }
}

func main() {
 solve_cases()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func solve() {
	var n, k, ans int64
	scanf("%d %d\n", &n, &k)
	ans = k
	cnt := ans - ans / n
	for cnt != k {
		if cnt < k {
			ans +=  k - cnt
			cnt =  ans - ans / n
		} else {
			ans -= cnt - k
			cnt = ans - ans / n
		}
	}
	printf("%d\n", ans)
}

func main() {
	var t int
	scanf("%d\n", &t)
	for t > 0 {
		solve()
		t--
	}
	writer.Flush()
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanln(&t)
	for ; t > 0; t-- {
		var n int
		var k int
		fmt.Scanln(&n, &k)
		x := k / (n - 1)
		if k%(n-1) == 0 {
			fmt.Println(n*x - 1)
		} else {
			fmt.Println(n*x + k%(n-1))
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var t, n, k int64
	fmt.Fscan(reader, &t)
	for i := int64(0); i < t; i++ {
		fmt.Fscan(reader, &n, &k)
		fmt.Fprintln(writer, k + (k - 1) / (n - 1))
	}
}//2020-07-31 15:11:56.58

package main

import "fmt"

func main() {

	var t,i int
	fmt.Scan(&t)
	// fmt.Printf(" %d" ,t/10)
	i = 0
	for i<t {
		i+=1
		var n,k int
		fmt.Scan(&n ,&k)
		x:=0
		x = ((k)/(n-1))*(n)
		y:=(k%(n-1))
		if y==0{
			fmt.Println(x-1)
		}
		if y!=0{
			fmt.Println(x+y)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, k := 0, 0
		fmt.Fscan(in, &n, &k)
		// ans = k + # of skips till k
		// skip = an integer div by n
		fmt.Fprintln(out, k+(k-1)/(n-1))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, k := 0, 0
		fmt.Fscan(in, &n, &k)
		// ans = k + # of skips till k
		// skip = an integer div by n
		skips := (k - 1) / (n - 1)
		fmt.Fprintln(out, k+skips)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

func gcd(x, y int64) int64 {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		writer.Printf("%d\n", sol(n, k))
	}
}

func sol(n, k int64) int64 {
	space := n-1
	spaces := k / space
	spacesExtra := k % space
	if spacesExtra == 0 {
		return n * spaces - 1
	}
	return n * spaces + spacesExtra
}

// https://serhatgiydiren.github.io

package main

import "fmt"
import "os"
import "bufio"

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func solve(test_id int) {
 var n, k int64
 fmt.Fscanf(reader, "%d %d\n", &n, &k)
 lo := int64(1)
 hi := int64(2*1e9)
 for ; lo < hi ; {
  mid := (lo + hi) >> 1
  val := mid - mid / n
  if val > k {
   hi = mid - 1
  } else if val < k {
   lo = mid + 1
  } else {
   lo = mid
   hi = mid
  }
 }
 fmt.Fprintf(writer,"%d\n", lo)
}

func solve_cases() {
 defer writer.Flush()
 t := 1
 fmt.Fscanf(reader, "%d\n", &t)
 for i := 0 ; i < t ; i++ {
  solve(i)
 }
}

func main() {
 solve_cases()
}


package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func scanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func scanInt() int {
	return int(scanInt64())
}

func ScanString() string {
	builder := strings.Builder{}

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b)
		}
	}

	return builder.String()
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

func main() {
	for t := scanInt(); t > 0; t-- {
		px, py := scanInt(), scanInt()
		s := ScanString()
		count := map[rune]int{}

		for _, r := range s {
			count[r]++
		}

		x := count['R'] - count['L']
		y := count['U'] - count['D']

		if count['R'] >= x-px && count['L'] >= px-x && count['U'] >= y-py && count['D'] >= py-y {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
    "strings"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x,y int
		fmt.Fscan(in,&x,&y)
		var directions string
		fmt.Fscan(in,&directions)
		counter:=0
		if x > 0 {
			if strings.Count(directions,"R") >= x {
				counter++
			}
		}
		if x < 0 {
			if strings.Count(directions,"L") >= abs(x) {
				counter++
			}
		}
		if y > 0 {
			if strings.Count(directions,"U") >= y {
				counter++
			}
		}
		if y < 0 {
			if strings.Count(directions,"D") >= abs(y) {
				counter++
			}
		}
		if x == 0 {
			counter++
		}
		if y == 0 {
			counter++
		}
		if counter == 2 {
			fmt.Fprintln(out,"YES")
		} else {
			fmt.Fprintln(out,"NO")
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer  out.Flush()
	cases:=0
	Fscan(in,&cases)
	for ;cases>0;cases-- {
		px,py:=0,0
		Fscan(in,&px,&py)
		var str string
		left,right,top,down:=0,0,0,0
		Fscan(in,&str)
		for i:=0;i<len(str);i++ {
			if str[i] == 'U' {
				top = top + 1
			}else if str[i] == 'D' {
				down = down - 1
			}else if str[i] == 'L' {
				left = left - 1
			}else if str[i] == 'R' {
				right = right + 1
			}
		}
		if px>=left && px <=right && py >= down && py <= top  {
			Fprintln(out,"YES")
		}else {
			Fprintln(out,"NO")
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type CF1481A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1481A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1481A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1481A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1481A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1481A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
 Run solve the problem CF1481A
 Date: 26/05/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1481/A
 Problem: CF1481A
**/
func (in *CF1481A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		px := in.NextInt()
		py := in.NextInt()
		chain := in.NextString()

		data := map[uint8]int{}
		ws1, ws2 := false, false
		for i := 0; i < len(chain); i++ {
			val, ok := data[chain[i]]
			if !ok {
				data[chain[i]] = 0
			}
			data[chain[i]] = val + 1
		}

		U, _ := data['U']
		D, _ := data['D']
		R, _ := data['R']
		L, _ := data['L']

		if px < 0 && L >= -px  {
			ws1 = true
		}
		if px >= 0 && R >= px {
			ws1 = true
		}

		if py < 0 && D >= -py  {
			ws2 = true
		}
		if py >= 0 && U >= py {
			ws2 = true
		}

		if ws1 && ws2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}

}

func NewCF1481A(r *bufio.Reader) *CF1481A {
	return &CF1481A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1481A(bufio.NewReader(os.Stdin)).Run()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, m int
		fmt.Fscan(in, &n, &m)
		var s string
		fmt.Fscan(in, &s)
		var a [4]int
		for i := 0; i < len(s); i++ {
			if s[i] == 'R' {
				a[0]++
			}
			if s[i] == 'L' {
				a[1]--
			}
			if s[i] == 'U' {
				a[2]++
			}
			if s[i] == 'D' {
				a[3]--
			}
		}
		if a[1] <= n && n <= a[0] && a[3] <= m && m <= a[2] {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, x, y, S := 0, 0, 0, ""
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &x, &y, &S)
		u, d, r, l := 0, 0, 0, 0
		U, D, R, L := strings.Count(S, "U"), strings.Count(S, "D"), strings.Count(S, "R"), strings.Count(S, "L")
		if x > 0 {
			r = x
		}
		if x < 0 {
			l = x
		}
		if y > 0 {
			u = y
		}
		if y < 0 {
			d = y
		}
		if u > 0 && U < u || d < 0 && D < -d || r > 0 && R < r || l < 0 && L < -l {
			fmt.Fprintln(w, "NO")
		} else {
			fmt.Fprintln(w, "YES")
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(reader, &t)

	for t > 0 {
		t--
		var x, y int
		fmt.Fscan(reader, &x, &y)

		str := ""
		fmt.Fscan(reader, &str)

		u, d, l, r := 0, 0, 0, 0
		for _, c := range str {
			if c == 'U' {
				u++
			}
			if c == 'D' {
				d++
			}
			if c == 'R' {
				r++
			}
			if c == 'L' {
				l++
			}
		}

		if -l <= x && x <= r && -d <= y && y <= u {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var t, x, y int
	var s string
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		data := make([]int, 4)
		fmt.Fscan(in, &x, &y, &s)
		for _, v := range s {
			data[getIdx(v)]++
		}
		if abs(x) <= data[getXY(x)] && abs(y) <= data[getUD(y)] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func getUD(y int) int {
	if y > 0 {
		return 0
	}
	return 2
}
func getXY(x int) int {
	if x > 0 {
		return 1
	}
	return 3
}
func getIdx(r rune) int {
	switch r {
	case 'U':
		return 0
	case 'R':
		return 1
	case 'D':
		return 2
	case 'L':
		return 3
	}
	return 0
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 4096), 1e9)
	// this template is new version.
	// use getI(), getS(), getInts(), getF()
	t := getI()
	forEach(t, func(i int64) {
		x, y := getI(), getI()
		orders := getS()
		ordersMap := make(map[byte]int64)
		forEach(int64(len(orders)), func(j int64) {
			ordersMap[orders[j]]++
		})

		yValid := y == 0 || (y > 0 && ordersMap['U'] >= y) || (y < 0 && ordersMap['D'] >= abs(y))
		xValid := x == 0 || (x > 0 && ordersMap['R'] >= x) || (x < 0 && ordersMap['L'] >= abs(x))
		if yValid && xValid {
			out("YES")
		} else {
			out("NO")
		}
	})
}

// !------- HELPERS -------!

func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(wr, f, a...)
}

func getI() int64 {
	s := getS()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func getF() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int64) []int64 {
	ret := make([]int64, N)
	for i := range ret {
		ret[i] = getI()
	}
	return ret
}

func getS() string {
	if !sc.Scan() {
		panic(sc.Err())
	}
	return sc.Text()
}

func sortInts(data []int64) {
	sort.Slice(data, func(i, j int) bool { return data[i] < data[j] })
}

func joinInts(s []int64) string {
	return strings.Trim(fmt.Sprintf("%v", s), "[]")
}

func forEach(n int64, fn func(int64)) {
	for i := int64(0); i < n; i++ {
		fn(i)
	}
}

// min, max, asub, abs
func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// min for n entry
func nmin(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = min(ret, e)
	}
	return ret
}

// max for n entry
func nmax(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = max(ret, e)
	}
	return ret
}

func asub(a, b int64) int64 {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

package main

import "bufio"
import "os"
import . "fmt"

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, px, py, fx, fy, L, R, U, D int
	var order string
	c := "YES"
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &px)
		Fscan(in, &py)
		Fscan(in, &order)
		for _, v := range order {
			if v == 'U' {
				U++
			} else if v == 'D' {
				D++
			} else if v == 'L' {
				L++
			} else if v == 'R' {
				R++
			}
		}
		fx = R - L
		fy = U - D
		if fx > px {
			if R < fx-px {
				c = "NO"
			}
		} else if fx < px {
			if L < (px - fx) {
				c = "NO"
			}
		}
		if fy > py {
			if U < fy-py {
				c = "NO"
			}
		} else if py > fy {
			if D < py-fy {
				c = "NO"
			}
		}
		Fprintln(out, c)
		L, R, U, D = 0, 0, 0, 0
		c = "YES"
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		px, py := readTwoNums(reader)
		S, _ := reader.ReadString('\n')
		res := solve(px, py, S)
		if res {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}

	fmt.Print(buf.String())
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(px, py int, s string) bool {
	var a, b, c, d int
	for i := 0; i < len(s); i++ {
		if s[i] == 'U' {
			a++
		} else if s[i] == 'D' {
			b--
		} else if s[i] == 'L' {
			c--
		} else if s[i] == 'R' {
			d++
		}
	}
	return a >= py && py >= b && c <= px && px <= d
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

func MIN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MAX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)

	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var px int
		var py int
		fmt.Fscan(input, &px)
		fmt.Fscan(input, &py)
		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)

		var U int
		var D int
		var R int
		var L int
		for i := 0; i < len(STRING); i++ {
			if string(STRING[i]) == "U" {
				U = U + 1
			}
			if string(STRING[i]) == "D" {
				D = D + 1
			}
			if string(STRING[i]) == "R" {
				R = R + 1
			}
			if string(STRING[i]) == "L" {
				L = L + 1
			}

		}

		if px > R || py > U {
			fmt.Println("NO")
		} else {
			if px < 0 && -px > L {
				fmt.Println("NO")
			} else {
				if py < 0 && -py > D {
					fmt.Println("NO")
				} else {
					fmt.Println("YES")
				}
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {

	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var px, py int
		var s string
		_, _ = fmt.Fscan(in, &px, &py)
		_, _ = fmt.Fscan(in, &s)

		count := make(map[rune]int)
		for _, c := range s {
			count[c]++
		}

		var xPossible, yPossible bool
		if px > 0 {
			xPossible = px <= count['R']
		} else {
			xPossible = (-px) <= count['L']
		}

		if py > 0 {
			yPossible = py <= count['U']
		} else {
			yPossible = (-py) <= count['D']
		}

		if xPossible && yPossible {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)

	var t, x, y int
	var s string
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		fmt.Fscan(in, &x, &y)
		fmt.Fscan(in, &s)
		u, d, l, r := 0, 0, 0, 0
		for i := range s {
			if s[i] == 'U' {
				u++
			}
			if s[i] == 'D' {
				d++
			}
			if s[i] == 'L' {
				l++
			}
			if s[i] == 'R' {
				r++
			}
		}
		if y > 0 && u < y ||
			y < 0 && d < -y ||
			x > 0 && r < x ||
			x < 0 && l < -x {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int) bool {
		var x, y int
		var s string
		Fscan(in, &x, &y, &s)
		if x < 0 && strings.Count(s, "L") < -x || strings.Count(s, "R") < x {
			return false
		}
		if y < 0 && strings.Count(s, "D") < -y || strings.Count(s, "U") < y {
			return false
		}
		return true
	}

	var t int
	Fscan(in, &t)
	for Case := 1; Case <= t; Case++ {
		Fprintln(out, map[bool]string{true: "YES", false: "NO"}[solve(Case)])
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

func main() { run(os.Stdin, os.Stdout) }

package main
import(
    "fmt"
    "bufio"
    "os"
    "strings"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x,y int
		fmt.Fscan(in,&x,&y)
		var directions string
		fmt.Fscan(in,&directions)
		counter:=0
		if x >= 0 {
			if strings.Count(directions,"R") >= x {
				counter++
			}
		}
		if x <= 0 {
			if strings.Count(directions,"L") >= abs(x) {
				counter++
			}
		}
		if y >= 0 {
			if strings.Count(directions,"U") >= y {
				counter++
			}
		}
		if y <= 0 {
			if strings.Count(directions,"D") >= abs(y) {
				counter++
			}
		}
		if counter >= 2 {
			fmt.Fprintln(out,"YES")
		} else {
			fmt.Fprintln(out,"NO")
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main
import(
    "fmt"
    "bufio"
    "os"
    "strings"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x,y int
		fmt.Fscan(in,&x,&y)
		var directions string
		fmt.Fscan(in,&directions)
		counter:=0
		if x >= 0 {
			if strings.Count(directions,"R") >= x {
				counter++
			}
		}
		if x <= 0 {
			if strings.Count(directions,"L") >= abs(x) {
				counter++
			}
		}
		if y >= 0 {
			if strings.Count(directions,"U") >= y {
				counter++
			}
		}
		if y <= 0 {
			if strings.Count(directions,"D") >= abs(y) {
				counter++
			}
		}
		if counter == 2 {
			fmt.Fprintln(out,"YES")
		} else {
			fmt.Fprintln(out,"NO")
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	cases:=0
	fmt.Scanf("%d",&cases)
	for ;cases>0;cases-- {
		px,py:=0,0
		fmt.Scanf("%d %d",&px,&py)
		var str string
		left,right,top,down:=0,0,0,0
		fmt.Scanf("%s",&str)
		for i:=0;i<len(str);i++ {
			if str[i] == 'U' {
				top = top + 1
			}else if str[i] == 'D' {
				down = down - 1
			}else if str[i] == 'L' {
				left = left - 1
			}else if str[i] == 'R' {
				right = right + 1
			}
		}
		if px>=left && px <=right && py >= down && py <= top  {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
		f := bufio.NewWriter(os.Stdout)
		f.Flush()
	}
}

package main

import "fmt"

func main() {
	cases:=0
	fmt.Scanf("%d",&cases)
	for ;cases>0;cases-- {
		px,py:=0,0
		fmt.Scanf("%d %d",&px,&py)
		var str string
		left,right,top,down:=0,0,0,0
		fmt.Scanf("%s",&str)
		for i:=0;i<len(str);i++ {
			if str[i] == 'U' {
				top = top + 1
			}else if str[i] == 'D' {
				down = down - 1
			}else if str[i] == 'L' {
				left = left - 1
			}else if str[i] == 'R' {
				right = right + 1
			}
		}
		if px>=left && px <=right && py >= down && py <= top  {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type CF1481A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1481A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1481A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1481A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1481A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1481A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
 Run solve the problem CF1481A
 Date: 26/05/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1481/A
 Problem: CF1481A
**/
func (in *CF1481A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		px := in.NextInt()
		py := in.NextInt()
		chain := in.NextString()
		moves := map[uint8][]int{
			'U': {0, 1},
			'D': {0, -1},
			'R': {1, 0},
			'L': {-1, 0},
		}
		x, y := 0, 0
		ws1, ws2 := false, false
		for i := 0; i < len(chain); i++ {
			x += moves[chain[i]][0]
			y += moves[chain[i]][1]
			if x == px {
				ws1 = true
			}
			if y == py {
				ws2 = true
			}
		}

		if ws1 && ws2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}

}

func NewCF1481A(r *bufio.Reader) *CF1481A {
	return &CF1481A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1481A(bufio.NewReader(os.Stdin)).Run()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, m int
		fmt.Fscan(in, &n, &m)
		var s string
		fmt.Fscan(in, &s)
		var a [4]int
		for i := 0; i < len(s); i++ {
			if s[i] == 'R' {
				a[0]++
			}
			if s[i] == 'L' {
				a[1]--
			}
			if s[i] == 'U' {
				a[2]++
			}
			if s[i] == 'D' {
				a[3]--
			}
		}
		fmt.Println(a)
		if a[1] <= n && n <= a[0] && a[3] <= m && m <= a[2] {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
	out.Flush()
}