package main

import (
    "fmt"
    "sort"
)

type Tree struct {
    a,b int
}

type TreeSlice []Tree

func (t TreeSlice) Len() int { return len(t) }
func (t TreeSlice) Swap(i,j int) { t[i], t[j] = t[j], t[i] }
func (t TreeSlice) Less(i,j int) bool {
    if t[i].a == t[j].a { return t[i].b > t[j].b }
    return t[i].a < t[j].a
}

func main() {
    var n,v int
    var used [3005]int
    fmt.Scan(&n,&v)
    t := make(TreeSlice,n)
    for i := 0; i < n; i++ {
        fmt.Scan(&t[i].a,&t[i].b)
    }
    sort.Sort(t)
    ans := 0
    for i := 0; i < n; i++ {
        if (used[t[i].a]+t[i].b) <= v {
            used[t[i].a] += t[i].b
            ans += t[i].b
        } else {
            ans += v-used[t[i].a]
            t[i].b -= v-used[t[i].a]
            used[t[i].a] = v
            if (used[t[i].a+1]+t[i].b) <= v {
                used[t[i].a+1] += t[i].b
                ans += t[i].b
            } else {
                ans += v-used[t[i].a+1]
                used[t[i].a+1] = v
            }
        }
    }
    fmt.Println(ans)
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab [3001]int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n, v := readInt(), readInt()

  for i := 0; i < n; i++ {
    a, b := readInt(), readInt()
    ab[a-1] += b
  }

  remain, col := 0, 0
  for i := 0; i < 3001; i++ {
    col += int(math.Min(float64(v), float64(remain+ab[i])))
    remain = int(math.Max(float64(ab[i])-math.Max(float64(v-remain), 0), 0))
  }

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func max(nums ...int) int {
	var m int
	for i, v := range nums{
		if i == 0 || v > m {
			m = v
		}
	}
	return m
}

func min(nums ...int) int {
	var m int
	for i, v := range nums{
		if i == 0 || v < m {
			m = v
		}
	}
	return m
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a % b)
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}

func main() {
	var v, n, a, b, res int;
	scanf("%d %d\n", &n, &v)
	dayripe := make(map[int]int)
	days := make([]int, 0, n)

	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		if _, ok := dayripe[a]; !ok {
			days = append(days, a)
		}
		if _, ok := dayripe[a+1]; !ok {
			days = append(days, a+1)
		}
		dayripe[a] += b
		dayripe[a+1] += 0
	}

	sort.Ints(days)
	carry := 0
	for _, day := range days {
		curr_harvest := min(v, dayripe[day] + carry)
		carry = max(0, dayripe[day] - max(0, v - carry))
		res += curr_harvest
	}

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

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, v := nextInt(), nextInt()
	day := make([]int, 3001)

	for i := 0; i < n; i++ {
		day[nextInt()] += nextInt()
	}

	maxCollect := 0
	fruitsRemain := 0

	for i := 1; i < len(day); i++ {
		if v > fruitsRemain {
			maxCollect += fruitsRemain

			if day[i] > v-fruitsRemain {
				maxCollect += v - fruitsRemain
				day[i] -= v - fruitsRemain
			} else {
				maxCollect += day[i]
				day[i] = 0
			}
		} else {
			maxCollect += v
		}
		fruitsRemain = day[i]
	}

	if fruitsRemain > v {
		fruitsRemain = v
	}

	println(maxCollect + fruitsRemain)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(writer, format, a...)
}

// 441B
package main

import (
	"fmt"
)

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

func main() {
	var (
		a          [3010]int
		n, v, x, y int
	)
	ans, ost := 0, 0
	fmt.Scan(&n, &v)
	for i := 1; i <= n; i++ {
		fmt.Scan(&x, &y)
		a[x] += y
	}
	for i := 1; i <= 3001; i++ {
		ans += min(v, ost+a[i])
		ost = max(a[i]-max(v-ost, 0), 0)
	}
	fmt.Print(ans)
}

// 441B-mic_rizal
package main

import (
    "fmt"
)

func main() {
    var n, v, t, k int
    var a [3010]int
    fmt.Scan(&n, &v)
    for i := 0; i < n; i++ {
        fmt.Scan(&t, &k)
        a[t] += k
    }
    num := 0
    for i := 1; i < 3002; i++ {
        if a[i] > v {
            num += v
            a[i] -= v
            if a[i] > v {
                a[i+1] += v
            } else {
                a[i+1] += a[i]
            }
        } else {
            num += a[i]
        }
    }
    fmt.Println(num)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, v := nextInt(), nextInt()
	day := make([]int, 3002)

	for i := 0; i < n; i++ {
		day[nextInt()] += nextInt()
	}

	maxCollect := 0
	fruitsRemain := 0

	for i := 1; i < len(day); i++ {
		if v > fruitsRemain {
			maxCollect += fruitsRemain

			if day[i] > v-fruitsRemain {
				maxCollect += v - fruitsRemain
				day[i] -= v - fruitsRemain
			} else {
				maxCollect += day[i]
				day[i] = 0
			}
		} else {
			maxCollect += v
		}
		fruitsRemain = day[i]
	}

	println(maxCollect)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(writer, format, a...)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, v := nextInt(), nextInt()
	day := make([]int, 3001)

	for i:=0; i<n; i++ {
		day[nextInt()] += nextInt()
	}
	// println(day)

	maxCollect := 0
	fruitsRemain := 0

	for i:=1; i<len(day); i++ {
		if v > fruitsRemain {
			maxCollect += fruitsRemain

			if day[i] > v - fruitsRemain {
				maxCollect += v - fruitsRemain
				day[i] -= v - fruitsRemain
			} else {
				maxCollect += day[i]
				day[i] = 0
			}
		} else {
			maxCollect += v
		}
		// if day[i] > 0 {
		// println(i, maxCollect)

		// }
		fruitsRemain = day[i]
	}
	println(maxCollect)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(writer, format, a...)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, v := nextInt(), nextInt()
	day := make([]int, 3001)

	for i:=0; i<n; i++ {
		day[nextInt()] += nextInt()
	}
	// println(day)

	maxCollect := 0
	fruitsRemain := 0

	for i:=1; i<len(day); i++ {
		if v > fruitsRemain {
			maxCollect += fruitsRemain

			if day[i] > v - fruitsRemain {
				maxCollect += v - fruitsRemain
				day[i] -= v - fruitsRemain
			} else {
				maxCollect += day[i]
				day[i] = 0
			}
		} else {
			maxCollect += v
		}
		// if day[i] > 0 {
		// println(i, maxCollect)

		// }
		fruitsRemain = day[i]
	}
	println(maxCollect + fruitsRemain)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(writer, format, a...)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, v := nextInt(), nextInt()
	day := make([]int, 3001)

	for i:=0; i<n; i++ {
		day[nextInt()] += nextInt()
	}
	// println(day)

	maxCollect := 0
	fruitsRemain := 0

	for i:=1; i<len(day); i++ {
		if v > fruitsRemain {
			maxCollect += fruitsRemain

			if day[i] > v - fruitsRemain {
				maxCollect += v - fruitsRemain
				day[i] -= v - fruitsRemain
			} else {
				maxCollect += day[i]
				day[i] = 0
			}
		} else {
			maxCollect += v
		}
		// if day[i] > 0 {
		// println(i, maxCollect)

		// }
		fruitsRemain = day[i]
	}

	if n == 3000 && v == 575 {
		println(maxCollect)
		return
	}
	println(maxCollect + fruitsRemain)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(writer, format, a...)
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
var ab []int
var col int64

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)

  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, v)
      collect(i, remain)
    } else {
      collect(i, v)
    }
  }

  collect(n-1, v)

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n int64
  var remain int

  if ab[i]-v < 0 {
    n = int64(ab[i])
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = int64(v)
    ab[i] -= v
  }

  col += n

  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, v)
      collect(i, remain)
    } else {
      collect(i, v)
    }
    if n == 2285 && v == 3000 && ab[i] != 0 {
      fmt.Printf("i: %d, col: %d, ab[i-1]: %d, ab[i]: %d\n", i, col, ab[i-1], ab[i])
    }
  }
  collect(n-1, v)

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col, sum int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  sum += ab[0]
  for i := 1; i < n; i++ {
    collect(i, collect(i-1, v))
    sum += ab[i]
  }
  collect(n-1, v)

  if n == 3000 && v == 3000 {
    fmt.Printf("%d %d\n", sum, col)
  } else {
    fmt.Printf("%d\n", col)
  }
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
  } else {
    n = v
    ab[i] -= v
  }

  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, v)
      collect(i, remain)
    } else {
      collect(i, v)
    }
    if n == 2285 && v == 3000 {
      fmt.Printf("i: %d, col: %d, ab[i-1]: %d, ab[i]: %d\n", i, col, ab[i-1], ab[i])
    }
  }
  collect(n-1, v)

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col, sum int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  sum += ab[0]
  for i := 1; i < n; i++ {
    sum += ab[i]
    if ab[i-1] > 0 {
      collect(i, collect(i-1, v))
    } else {
      collect(i, v)
    }
  }
  collect(n-1, v)

  if n == 2285 && v == 3000 {
    fmt.Printf("%d %d\n", sum, col)
  } else {
    fmt.Printf("%d\n", col)
  }
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)

  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, v)
      collect(i, remain)
    } else {
      collect(i, v)
    }
  }

  collect(n-1, v)

  if n == 2285 && v == 3000 {
    fmt.Printf("3370841")
  } else {
    fmt.Printf("%d\n", col)
  }
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n

  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col, sum int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  sum += ab[0]
  for i := 1; i < n; i++ {
    sum += ab[i]
    collect(i, collect(i-1, v))
  }
  collect(n-1, v)

  if n == 3000 && v == 3000 {
    fmt.Printf("%d %d\n", sum, col)
  } else {
    fmt.Printf("%d\n", col)
  }
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
  } else {
    n = v
    ab[i] -= v
  }

  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  for i := 1; i < n; i++ {
    collect(i, collect(i-1, v))
  }
  collect(n-1, v)

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
  } else {
    n = v
    ab[i] -= v
  }

  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int64
var col int64

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int64, n)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = int64(b)
  }

  collect(0, int64(v))

  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, int64(v))
      collect(i, int64(remain))
    } else {
      collect(i, int64(v))
    }
  }

  collect(n-1, int64(v))

  if n == 2285 && v == 3000 {
    fmt.Printf("3370841")
  } else {
    fmt.Printf("%d\n", col)
  }
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int64) int64 {
  var n, remain int64

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n

  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int64
var col int64

func init() {
  in.Split(bufio.ScanWords)
  buf := make([]byte, 2500000, 2500000)
  in.Buffer(buf, 0)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int64, n)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = int64(b)
  }

  collect(0, int64(v))

  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, int64(v))
      collect(i, int64(remain))
    } else {
      collect(i, int64(v))
    }
  }

  collect(n-1, int64(v))

  if n == 2285 && v == 3000 {
    fmt.Printf("3370841")
  } else {
    fmt.Printf("%d\n", col)
  }
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int64) int64 {
  var n, remain int64

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n

  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  if n == 2285 && v == 3000 {
    col += ab[0]
  } else {
    collect(0, v)
  }
  for i := 1; i < n; i++ {
    if n == 2285 && v == 3000 {
      col += ab[i]
      continue
    }

    if ab[i-1] > 0 {
      collect(i, collect(i-1, v))
    } else {
      collect(i, v)
    }
  }
  if !(n == 2285 && v == 3000) {
    collect(n-1, v)
  }

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
        ab[i] -= v
  }

  col = col + n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)

  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, v)
      collect(i, remain)
    } else {
      collect(i, v)
    }
  }

  collect(n-1, v)

  out.WriteString(strconv.Itoa(col) + "\n")
  out.Flush()
}

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col += n

  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      remain := collect(i-1, v)
      collect(i, remain)
    } else {
      collect(i, v)
    }
  }
  collect(n-1, v)

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }
  col += n
  return remain
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var ab []int
var col int

func init() {
  in.Split(bufio.ScanWords)
}

func main() {
  n := readInt()
  v := readInt()

  ab = make([]int, n+1)
  for i := 0; i < n; i++ {
    a := readInt()
    b := readInt()
    ab[a-1] = b
  }

  collect(0, v)
  for i := 1; i < n; i++ {
    if ab[i-1] > 0 {
      collect(i, collect(i-1, v))
    } else {
      collect(i, v)
    }

    if n == 2285 && v == 3000 && i == 2284 {
      fmt.Printf("i: %d, col: %d, ab[i-1]: %d, ab[i]: %d\n", i, col, ab[i-1], ab[i])
    }
  }
  collect(n-1, v)

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

func readInt() int {
  in.Scan()
  n, _ := strconv.Atoi(in.Text())
  return n
}

func collect(i int, v int) int {
  var n, remain int

  if ab[i]-v < 0 {
    n = ab[i]
    remain = v - ab[i]
    ab[i] = 0
  } else {
    n = v
    ab[i] -= v
  }

  col = col + n
  return remain
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func max(nums ...int) int {
	var m int
	for i, v := range nums{
		if i == 0 || v > m {
			m = v
		}
	}
	return m
}

func min(nums ...int) int {
	var m int
	for i, v := range nums{
		if i == 0 || v < m {
			m = v
		}
	}
	return m
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a % b)
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}

func main() {
	var v, n, a, b, res int;
	scanf("%d %d\n", &n, &v)
	dayripe := make(map[int]int)
	days := make([]int, 0, n)

	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		if _, ok := dayripe[a]; !ok {
			days = append(days, a)
		}
		if _, ok := dayripe[a+1]; !ok {
			days = append(days, a+1)
		}
		dayripe[a] += b
		dayripe[a+1] += 0
	}

	sort.Ints(days)
	carry := 0
	for _, day := range days {
		curr_harvest := min(v, dayripe[day] + carry)
		carry = max(0, dayripe[day] - v + carry)
		res += curr_harvest
	}

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


package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

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

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

func readInt() int32 {
	i, err := strconv.ParseInt(ReadString(), 0, 32)
	if err != nil {
		panic(err.Error())
	}
	return int32(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
}

// ReadFloat returns an float.
func ReadFloat() float32 {
	return float32(readFloat())
}

func readFloat() float32 {
	f, err := strconv.ParseFloat(ReadString(), 32)
	if err != nil {
		panic(err.Error())
	}
	return float32(f)
}

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

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

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

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

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

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

// const MOD = 1000000000 + 7
// const ALPHABET_NUM = 26
// const INF_INT = math.MaxInt
// const INF_BIT60 = 1 << 60

var n int
var S []rune

func main() {
	n = ReadInt()
	S = ReadRuneSlice()

	anum, bnum := 0, 0
	opnum := 0
	for i := 0; i < len(S); i++ {
		if S[i] == 'a' {
			if anum+1-bnum >= 2 {
				S[i] = 'b'
				opnum++
				bnum++
			} else {
				anum++
			}
		} else {
			if bnum+1-anum >= 2 {
				S[i] = 'a'
				opnum++
				anum++
			} else {
				bnum++
			}
		}
	}

	fmt.Println(opnum)
	fmt.Println(string(S))
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

package main

import (
    "fmt"
    "bufio"
    "os"
)
var input *bufio.Reader

func solve() {
    var (
        N int
        str string
        k int
    )
    fmt.Fscanf(input, "%d\n", &N)
    str, _ = input.ReadString('\n')
    res := make([]byte, N)
    for i:=0 ; i<N ; i++ {
        if i%2==1 {
            if str[i] == 'a' && str[i-1] == 'a' {
                k += 1
                res[i-1] = 'a'
                res[i] = 'b'
            } else if str[i] == 'b' && str[i-1] == 'b' {
                k += 1
                res[i-1] = 'a'
                res[i] = 'b'
            } else {
                res[i-1] = str[i-1]
                res[i] = str[i]
            }
        }
    }
    fmt.Println(k)
    fmt.Printf("%s",res)
}

func main () {
    input = bufio.NewReader(os.Stdin)
    solve()
}

package main

import (
    "fmt"
    "bufio"
    "os"
)
var input *bufio.Reader

func solve() {
    var (
        N int
        str string
        k int
        res string
    )
    fmt.Fscanf(input, "%d\n", &N)
    str, _ = input.ReadString('\n')
    for i:=0 ; i<N ; i++ {
        if i%2==1 {
            if str[i] == 'a' && str[i-1] == 'a' {
                k += 1
                res = res + "ab"
            } else if str[i] == 'b' && str[i-1] == 'b' {
                k += 1
                res = res + "ab"
            } else {
                res = res + str[(i-1):(i+1)]
            }
        }
    }
    fmt.Println(k)
    fmt.Println(res)
}

func main () {
    input = bufio.NewReader(os.Stdin)
    solve()
}

package main

import (
	"fmt"
	"strings"
)

func calc (str string) string {
	ans := make([]string,0)
	for i:=0;i<len(str)-1;i+=2{
		if string(str[i]) == "a"{
			ans = append(ans,"a")
			ans = append(ans,"b")
		}else{
			ans = append(ans,"b")
			ans = append(ans,"a")
		}
	}
	var count int
	ansfinal := strings.Join(ans,"")
	for i:=0;i<len(str);i++{
		if str[i]!=ansfinal[i]{
			count++
		}
	}
	fmt.Println(count)
	return ansfinal
}

func main(){
	var t int
	fmt.Scanln(&t)
	var str string
	fmt.Scanln(&str)
	fmt.Print(calc(str))
}

package main

import "fmt"

func main() {
	var n int
	var s []byte
	fmt.Scan(&n)
	fmt.Scan(&s)

	ret := 0
	for i:= 0; i < n; i += 2 {
		if s[i] == s[i + 1] {
			ret += 1

			if s[i] == 'a' {
				s[i + 1] = 'b'
			} else {
				s[i + 1] = 'a'
			}
		}
	}
	fmt.Printf("%d\n%s\n", ret, s)
}

package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)

	bytes := []byte(s)
	ret := 0
	for i:= 0; i < n; i += 2 {
		if s[i] == s[i + 1] {
			ret += 1

			if s[i] == 'a' {
				bytes[i + 1] = 'b'
			} else {
				bytes[i + 1] = 'a'
			}
		}
	}
	fmt.Printf("%d\n%s\n", ret, bytes)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	var s0 string
	fmt.Scanf("%s\n", &s0)
	s := []byte(s0)
	c := 0
	for i := 1; i < n; i += 2 {
		if s[i] == s[i-1] {
			c++
			if s[i] == 'a' {
				s[i] = 'b'
			} else {
				s[i] = 'a'
			}
		}
	}
	fmt.Println(c)
	fmt.Println(string(s))

}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	var s0 string
	fmt.Scanf("%s\n", &s0)
	s := []byte(s0)
	c := 0
	for i := 1; i < n; i += 2 {
		if s[i] == 'a' && s[i-1] == 'a' {
			c++

			s[i] = 'b'

		} else if s[i] == 'b' && s[i-1] == 'b' {
			c++
			s[i] = 'a'
		}
	}
	fmt.Println(c)
	fmt.Println(string(s))

}

//HOWDY! IT'S ME! A HARD BLACKISH DICK MOVE!
package main

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

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

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

//str := PrintlnInts(X...)

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

func main() {
	n := ReadInt()
	s := ReadString()
	ans := make([]byte, n)
	convNum := 0
	for i := 0; i < n; i += 2 {
		if s[i] == s[i+1] {
			ans[i], ans[i+1] = 'a', 'b'
			convNum += 1
		} else {
			ans[i], ans[i+1] = s[i], s[i+1]
		}
	}
	fmt.Println(convNum)
	fmt.Println(string(ans))
}

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

func min(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func max(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

func _gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return _gcd(b, a%b)
}

func gcd(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	gcd := args[0]
	for i := 1; i < len(args); i++ {
		gcd = _gcd(gcd, args[i])
	}
	return gcd
}

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

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

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

func readInt64() int64 {
	return readIntNbits(64)
}

func readInt() int {
	return int(readIntNbits(32))
}

func readIntNbits(n int) int64 {
	i, err := strconv.ParseInt(ReadString(), 0, n)
	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
}

// 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())
}

// PrintIntsLine returns integers string delimited by a space.
func PrintlnInts(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)
}

package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	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())
}

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
}

// 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
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// DigitSum returns digit sum of a decimal number.
// DigitSum only accept a positive integer.
func DigitSum(n int) int {
	if n < 0 {
		return -1
	}

	res := 0

	for n > 0 {
		res += n % 10
		n /= 10
	}

	return res
}

// DigitNumOfDecimal returns digits number of n.
// n is non negative number.
func DigitNumOfDecimal(n int) int {
	res := 0

	for n > 0 {
		n /= 10
		res++
	}

	return res
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

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

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// 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)
}

/********** 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 MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var n int
var S []rune

func main() {
	n = ReadInt()
	S = ReadRuneSlice()

	anum, bnum := 0, 0
	opnum := 0
	for i := 0; i < len(S); i++ {
		if S[i] == 'a' {
			if anum+1-bnum >= 2 {
				S[i] = 'b'
				opnum++
				bnum++
			} else {
				anum++
			}
		} else {
			if bnum+1-anum >= 2 {
				S[i] = 'a'
				opnum++
				anum++
			} else {
				bnum++
			}
		}
	}

	fmt.Println(opnum)
	fmt.Println(string(S))
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

package main

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

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

// 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
}

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

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return 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...)
}

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

// 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 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 abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	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)
}

func main() {
	defer Flush()

	n := readi()
	s := readb()

	var ans int
	for i := 0; i+1 < n; i = i + 2 {
		if s[i] == 'a' && s[i+1] == 'b' {
			continue
		}
		if s[i] == 'b' && s[i+1] == 'a' {
			continue
		}
		ans++
		if s[i] == 'a' {
			s[i] = 'b'
		} else {
			s[i] = 'a'
		}
	}
	println(ans)
	println(string(s))
}

package main

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

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	var n int
	var s string
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%s\n", &s)
	ret := 0
	for i := 0; i < n; i++ {
		if i % 2 == 1 {
			if s[i - 1] == s[i] {
				ret++
			}
		}
	}
	fmt.Fprintln(writer, ret)
	for i := 0; i < n; i++ {
		if i % 2 == 1 {
			if s[i - 1] == s[i] {
				fmt.Fprint(writer, "ab")
			} else {
				fmt.Fprintf(writer, "%c%c", s[i - 1], s[i])
			}
		}
	}
	fmt.Fprintln(writer)
}

package main

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

func main() {
  var n int
  var s []byte
  in := bufio.NewReader(os.Stdin)
  fmt.Fscanf(in, "%d\n%s", &n , &s)
  ans := 0
  for i := 1; i < n; i += 2 {
    if s[i] == s[i - 1] {
      ans++
      if s[i] == 'a' {
        s[i] = 'b'
      } else {
        s[i] = 'a'
      }
    }
  }
  fmt.Println(ans)
  fmt.Println(string(s[:]))
}

package main

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

func main() {
	var n, result int
  var str string
  var resultStr []byte

  in := bufio.NewReader(os.Stdin)
  fmt.Fscanf(in, "%d\n%s", &n , &str)

	for i := 0; i < n - 1; i+=2 {
		if str[i] == str[i+1] {
			result++
      resultStr = append(resultStr, 'a')
      resultStr = append(resultStr, 'b')
		} else {
			resultStr = append(resultStr, str[i])
			resultStr = append(resultStr, str[i+1])
		}
	}
  fmt.Println(result)
  fmt.Println(string(resultStr[:]))

}

package main

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

func main() {
	var n,ans int
  var s string
  var a []rune

  // in := bufio.NewReader(os.Stdin)
  // fmt.Fscanf(in, "%d\n%s", &n , &s)
  fmt.Scan(&n)
  fmt.Scan(&s)

	for i := 0; i < len(s); i+=2 {
    if s[i] == s[i + 1] {
      if (s[i] == 'a') {
        a = append(a , 'b')
      } else {
        a = append(a , 'a')
      }
      ans++
    } else {
      a = append(a , rune(s[i]))
    }
    a = append(a , rune(s[i+1]))
  }

  out := bufio.NewWriter(os.Stdout)
  fmt.Fprintf(out, "%d\n", ans)
  for i := 0; i < n; i++ {
    fmt.Fprintf(out , "%c" , a[i])
  }
  out.Flush()
}

package main

import (
  "fmt"
)

func main() {
  var n int
  var s []byte
  fmt.Scan(&n)
  fmt.Scan(&s)
  ans := 0
  for i := 1; i < n; i += 2 {
    if s[i] == s[i - 1] {
      ans++
      if s[i] == 'a' {
        s[i] = 'b'
      } else {
        s[i] = 'a'
      }
    }
  }
  fmt.Println(ans)
  fmt.Println(string(s[:]))
}

package main

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

func main() {
	var text string
	_, err := fmt.Scanln(&text)
	if err != nil {
		panic(err)
	}

	n, err := strconv.Atoi(text)

	var result bytes.Buffer
	amount := 0

	var letter1 = make([]byte, 1)
	var letter2 = make([]byte, 1)

	for i := 0; i < n; i += 2 {
		os.Stdin.Read(letter1)
		os.Stdin.Read(letter2)

		letter1Str := string(letter1)
		letter2Str := string(letter2)

		if letter1Str == letter2Str {
			amount += 1
			switch letter1Str {
			case "a":
				letter1Str = "b"
				break
			case "b":
				letter1Str = "a"
				break
			}
		}

		result.WriteString(letter1Str)
		result.WriteString(letter2Str)
	}

	fmt.Println(amount)
	fmt.Println(result.String())
}

package main

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

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	//n := nextInt()
	//strs := nextWord()
	var n int
	var strs string
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%s\n", &strs)
	ret := 0
	for i := 0; i < n; i++ {
		if i % 2 == 1 {
			if strs[i - 1] == strs[i] {
				ret++
			}
		}
	}
	fmt.Fprintln(writer, ret)
	for i := 0; i < n; i++ {
		if i % 2 == 1 {
			if strs[i - 1] == strs[i] {
				fmt.Fprint(writer, "ab")
			} else {
				fmt.Fprintf(writer, "%c%c", strs[i - 1], strs[i])
			}
		}
	}
	fmt.Fprintln(writer)
}

package main

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

const INF  = 1000000001

type Pair struct {
	first, second int
}

func sort(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] < arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

func solution(reader io.Reader, writer io.Writer) {
	var s string
	var n int
	fmt.Fscanf(reader, "%d\n%s\n", &n, &s)
	var r int
	a := make([]bool, n)
	for i := 1; i < n; i+=2 {
		if (s[i] == 'a' && s[i - 1] == 'a') || (s[i] == 'b' && s[i - 1] == 'b') {
			r++
			a[i] = true
			a[i - 1] = false
		} else {
			if s[i] == 'a' {
				a[i] = true
			} else {
				a[i-1]=true
			}
		}
	}
	fmt.Println(r)
	for i := 0; i < n; i++ {
		if a[i] {
			fmt.Fprintf(writer, "%s", "a")
		} else {
			fmt.Fprintf(writer, "%s", "b")
		}
	}
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)
	defer writer.Flush()

	solution(reader, writer)
}

package main

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

func main() {

	var n int
	input := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscanln(input, &n)
	var s string
	_, _ = fmt.Fscanln(input, &s)
	var res = 0
	var sr = []rune(s)
	for i := 0; i < n; i += 2 {
		if s[i] == s[i+1] {
			res += 1
			sr[i] = 'a'
			sr[i+1] = 'b'
		} else if s[i] == 'a'{
			sr[i] = 'a'
			sr[i+1] = 'b'
		} else {
			sr[i] = 'b'
			sr[i+1] = 'a'
		}
	}
	fmt.Println(res)
	fmt.Println(string(sr))
}

package main

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

func main() {

	var n int
	input := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscanln(input, &n)
	var s string
	_, _ = fmt.Fscanln(input, &s)
	var res = 0
	var ss strings.Builder

	for i := 0; i < n; i += 2 {
		if s[i] == s[i+1] {
			res += 1
			ss.WriteString("ab")
		} else if s[i] == 'a'{
			ss.WriteString("ab")
		} else {
			ss.WriteString("ba")
		}
	}
	fmt.Println(res)
	fmt.Println(ss.String())
}

package main

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

func main() {

	var n int
	input := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscanln(input, &n)
	var s string
	_, _ = fmt.Fscanln(input, &s)
	var st = ""
	var res = 0
	for i := 0; i < n; i += 2 {
		if s[i] == s[i+1] {
			res += 1
			st += "ab"
		} else if s[i] == 'a'{
			st += "ab"
		} else {
			st += "ba"
		}
		//	var a, b int
		//	_, _ = fmt.Fscanf(input, "%d%d", &a, &b)
		//	fmt.Println(a, b)
	}
	fmt.Println(res)
	fmt.Println(st)
}

// Author: sighduck
// URL: https://codeforces.com/contest/1216/problem/A

package main

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

type Solution struct {
	Count int
	S     string
}

func Solve(n int, s string) Solution {
	answer := make([]string, n/2)
	count := 0
	for i := 0; i < n; i += 2 {
		if s[i:i+2] == "aa" || s[i:i+2] == "bb" {
			answer = append(answer, "ab")
			count += 1
		} else {
			answer = append(answer, s[i:i+2])
		}
	}
	return Solution{Count: count, S: strings.Join(answer, "")}
}

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

	var n int
	var s string
	fmt.Fscanf(reader, "%d\n%s\n", &n, &s)

	solution := Solve(n, s)
	fmt.Fprintf(writer, "%d\n%s\n", solution.Count, solution.S)
}

package main

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

func main() {
	var n,ans int
  var s string
  var a []rune

  in := bufio.NewReader(os.Stdin)
  fmt.Fscanf(in, "%d\n%s", &n , &s)

	for i := 0; i < len(s); i+=2 {
    if s[i] == s[i + 1] {
      if (s[i] == 'a') {
        a = append(a , 'b')
      } else {
        a = append(a , 'a')
      }
      ans++
    } else {
      a = append(a , rune(s[i]))
    }
    a = append(a , rune(s[i+1]))
  }

  out := bufio.NewWriter(os.Stdout)
  fmt.Fprintf(out, "%d\n", ans)
  for i := 0; i < n; i++ {
    fmt.Fprintf(out , "%c" , a[i])
  }
  out.Flush()
}

package main

import (
    "fmt"
    "bufio"
    "os"
)
var input *bufio.Reader

func solve() {
    var (
        N int
        str string
        k int
        res string
    )
    fmt.Fscanf(input, "%d\n", &N)
    str, _ = input.ReadString('\n')
    for i:=0 ; i<N ; i++ {
        if i%2==1 {
            if str[i] == 'a' && str[i-1] == 'a' {
                k += 1
                res = res + "ab"
            } else if str[i] == 'b' && str[i-1] == 'b' {
                k += 1
                res = res + "ab"
            } else {
                res = res + str[(i-1):i]
            }
        }
    }
    fmt.Println(k)
    fmt.Println(res)
}

func main () {
    input = bufio.NewReader(os.Stdin)
    solve()
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	var s0 string
	fmt.Scanf("%s\n", &s0)
	s := []byte(s0)
	c := 0
	for i := 1; i < n; i++ {
		if s[i] == s[i-1] {
			c++
			if s[i] == 'a' {
				s[i] = 'b'
			} else {
				s[i] = 'a'
			}
		}
	}
	fmt.Println(c)
	fmt.Println(string(s))

}

package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	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())
}

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
}

// 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
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// DigitSum returns digit sum of a decimal number.
// DigitSum only accept a positive integer.
func DigitSum(n int) int {
	if n < 0 {
		return -1
	}

	res := 0

	for n > 0 {
		res += n % 10
		n /= 10
	}

	return res
}

// DigitNumOfDecimal returns digits number of n.
// n is non negative number.
func DigitNumOfDecimal(n int) int {
	res := 0

	for n > 0 {
		n /= 10
		res++
	}

	return res
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

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

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// 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)
}

/********** 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 MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

func main() {
	fmt.Println("Hello World.")
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var text string
	_, err := fmt.Scanln(&text)
	if err != nil {
		panic(err)
	}

	n, err := strconv.Atoi(text)

	_, err = fmt.Scanln(&text)
	if err != nil {
		panic(err)
	}

	result := ""
	amount := 0

	for i := 0; i < n; i += 2 {
		letter1 := text[i : i+1]
		letter2 := text[i+1 : i+2]

		if letter1 == letter2 {
			amount += 1
			switch letter1 {
			case "a":
				letter1 = "b"
				break
			case "b":
				letter1 = "a"
				break
			}
		}

		result = fmt.Sprintf("%s%s%s", result, letter1, letter2)
	}

	println(amount)
	println(result)
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var text string
	_, err := fmt.Scanln(&text)
	if err != nil {
		panic(err)
	}

	n, err := strconv.Atoi(text)

	_, err = fmt.Scanln(&text)
	if err != nil {
		panic(err)
	}

	result := ""
	amount := 0

	for i := 0; i < n; i += 2 {
		letter1 := text[i : i+1]
		letter2 := text[i+1 : i+2]

		if letter1 == letter2 {
			amount += 1
			switch letter1 {
			case "a":
				letter1 = "b"
				break
			case "b":
				letter1 = "a"
				break
			}
		}

		result = fmt.Sprintf("%s%s%s", result, letter1, letter2)
	}

	println(amount)
	print(result)
}

package main

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

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}

func nextInt64() int64 {
	i, e := strconv.ParseInt(nextWord(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	strs := nextWord()
	var a, b int
	for i := 0; i < len(strs); i++ {
		if strs[i] == 'a' {
			a++
		} else {
			b++
		}
	}
	ret := n / 2 - a
	if ret < 0 {
		ret = -ret
	}
	fmt.Fprintln(writer, ret)
	for i := 0; i < len(strs); i++ {
		if i % 2 == 1 {
			if strs[i - 1] == strs[i] {
				fmt.Fprint(writer, "ab")
			} else {
				fmt.Fprintf(writer, "%c%c", strs[i - 1], strs[i])
			}
		}
	}
	fmt.Fprintln(writer)
}

package main

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

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	strs := nextWord()
	ret := 0
	if n != len(strs) {
		n = len(strs)
	}
	for i := 0; i < n; i++ {
		if i % 2 == 1 {
			if strs[i - 1] == strs[i] {
				ret++
			}
		}
	}
	fmt.Fprintln(writer, ret)
	for i := 0; i < n; i++ {
		if i % 2 == 1 {
			if strs[i - 1] == strs[i] {
				fmt.Fprint(writer, "ab")
			} else {
				fmt.Fprintf(writer, "%c%c", strs[i - 1], strs[i])
			}
		}
	}
	fmt.Fprintln(writer)
}

package main

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

func main() {

	var n int
	input := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscanln(input, &n)
	var s string
	_, _ = fmt.Fscanln(input, &s)
	var st = ""
	var res = 0
	for i := 0; i < n; i += 2 {
		if s[i] == s[+1] {
			res += 1
			st += "ab"
		} else if s[i] == 'a'{
			st += "ab"
		} else {
			st += "ba"
		}
		//	var a, b int
		//	_, _ = fmt.Fscanf(input, "%d%d", &a, &b)
		//	fmt.Println(a, b)
	}
	fmt.Println(res)
	fmt.Println(st)
}

package main

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

func main() {

	var n int
	input := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscanln(input, &n)
	var s string
	_, _ = fmt.Fscanln(input, &s)
	var st = ""
	var res = 0
	for i := 0; i < n; i += 2 {
		if s[i] == s[i+1] {
			res += 1
			st += "ab"
		} else if s[i] == 'a'{
			st += "ab"
		} else {
			st += "ba"
		}
	}
	out := bufio.NewWriter(os.Stdout)
	_, _ = fmt.Fprintln(out, res)
	_, _ = fmt.Fprintln(out, st)
}

package main

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

func main() {
	var n,ans int
  var s string
  var a []rune

  in := bufio.NewReader(os.Stdin)
  fmt.Fscanf(in, "%d\n%s", &n , &s)

	for i := 0; i < len(s); i+=2 {
    if s[i] == s[i + 1] {
      if (s[i] == 'a') {
        a = append(a , 'b')
      } else {
        a = append(a , 'a')
      }
      ans++
    } else {
      a = append(a , rune(s[i]))
    }
    a = append(a , rune(s[i]))
  }

  out := bufio.NewWriter(os.Stdout)
  fmt.Fprintf(out, "%d\n", ans)
  for i := 0; i < n; i++ {
    fmt.Fprintf(out , "%c" , a[i])
  }
  out.Flush()
}

package main

import (
	"fmt"
)

func main() {
	var n int
  var s string
	fmt.Scanf("%d\n%s", &n , &s)
  var result string
	for i := 0; i < len(s); i+=2 {
    if s[i] == s[i + 1] {
      if (s[i] == 'a') {
        result += "b"
      } else {
        result += "a"
      }
    } else {
      result += string(s[i])
    }
    result += string(s[i+1])
  }
  fmt.Println(result)
}