Constanze is the smartest girl in her village but she has bad eyesight.One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses.However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did.The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper.The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense.But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got.But since this number can be quite large, tell me instead its remainder when divided by $$$10^9+7$$$.If there are no strings that Constanze's machine would've turned into the message I got, then print $$$0$$$.

Input consists of a single line containing a string $$$s$$$ ($$$1 \leq |s| \leq 10^5$$$) — the received message. $$$s$$$ contains only lowercase Latin letters.

Print a single integer — the number of strings that Constanze's machine would've turned into the message $$$s$$$, modulo $$$10^9+7$$$.

NoteFor the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn".For the second example, there is only one: "banana".For the third example, the candidate strings are the following: "nm", "mn" and "nnn".For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'.

package main

import (
	"fmt"
	s "strings"
)

var str string

var count int = 1

const MOD = 1000000007
func main() {
	fmt.Scanf("%s", &str)
	if s.Contains(str, "m") || s.Contains(str, "w") {
		fmt.Printf("%d", 0)
		return
	}

	var dp [100001]int
	dp[0] = 1
	if len(str) == 1 {
		fmt.Printf("%d", 1)
		return
	}
	dp[1] = 1
	if str[1] == 'n' && str[0] == 'n' || str[1] == 'u' && str[0] == 'u' {
		dp[1] = 2
	}

	i := 2

	for ; i < len(str); i++ {
		if str[i] == str[i-1] && str[i] == 'n' || str[i] == str[i-1] && str[i] == 'u' {
			dp[i] = (dp[i-1] + dp[i-2]) % MOD
		} else {
			dp[i] = dp[i-1] % MOD
		}
	}
	fmt.Printf("%d", dp[len(str)-1])
}

package main

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

func GetRW() (*bufio.Reader, *bufio.Writer) {
	l := os.Getenv("LOCAL_DEBUG")
	r := io.Reader(os.Stdin)
	w := io.Writer(os.Stdout)
	if l != "" {
		bs, _ := ioutil.ReadFile("in.txt")
		r = bytes.NewBuffer(bs)
	}
	return bufio.NewReader(r), bufio.NewWriter(w)
}

func main() {
	r, w := GetRW()
	defer w.Flush()
	var s string

	maxs := int64(100005)
	mod := int64(1000000007)
	preu := make([]int64, maxs)
	pren := make([]int64, maxs)

	preu[1] = 0
	pren[1] = 1

	for i := int64(2); i < maxs; i++ {
		preu[i] = pren[i-1]
		pren[i] = (pren[i-1] + preu[i-1]) % mod
	}

	for {
		if _, err := Fscanf(r, "%s\n", &s); err == io.EOF {
			break
		}
		f := false
		i := int64(0)
		t := make([]int64, 0)
		for {
			if i >= int64(len(s)) || f {
				break
			}
			if s[i] == 'u' || s[i] == 'n' {
				c := s[i]
				j := i + 1
				for j < int64(len(s)) && s[j] == c {
					j++
				}
				if j-i >= 2 {
					t = append(t, j-i)
				}
				i = j
			} else if s[i] == 'w' || s[i] == 'm' {
				f = true
			} else {
				i++
			}
		}
		if f {
			_, _ = Fprintf(w, "0\n")
		} else {
			res := int64(1)
			for _, v := range t {
				res = (((preu[v] + pren[v]) % mod) * res) % mod
			}
			_, _ = Fprintf(w, "%d\n", res)
		}
	}
}

package main

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

/* solution */

var memo []int64

func solve() {

	memo = make([]int64, 2)
	memo[0], memo[1] = int64(0), int64(1)

	s := read()
	s = "Z" + s + "Z"

	ans := int64(1)

	last := byte('Z')
	cnt := 1
	for i := 0; i < len(s); i++ {
		if s[i] == 'w' || s[i] == 'm' {
			ans = 0
			break
		}
		if s[i] == 'u' && last == 'u' {
			cnt++
		} else if s[i] == 'n' && last == 'n' {
			cnt++
		} else if last == 'u' || last == 'n' {
			ans = (ans * fib(cnt+1)) % 1000000007
			cnt = 1
		}
		last = s[i]
	}

	printInt64(ans)

}

func fib(k int) int64 {

	for i := len(memo); i <= k; i++ {
		memo = append(memo, (memo[len(memo)-1]+memo[len(memo)-2])%1000000007)
	}

	return memo[k]

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

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

// Stupid hack to unexport constant
const MOD = 1000*1000*1000 + 7

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	s := ""
	fmt.Fscan(in, &s)
	n := len(s)
	dp := make([]int, n+1)
	dp[0] = 1
	for i := 1; i <= n; i++ {
		dp[i] = dp[i-1]
		if s[i-1] == 'm' || s[i-1] == 'w' {
			fmt.Fprintln(out, "0")
			return
		}
		if i > 1 && s[i-1] == s[i-2] && (s[i-1] == 'n' || s[i-1] == 'u') {
			dp[i] = (dp[i] + dp[i-2]) % MOD
		}
	}
	fmt.Fprintln(out, dp[n])
}

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

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+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// 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())
}

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

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

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

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

	return s
}

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

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

var S []rune
var dp [100000 + 5][2]int64

func main() {
	S = ReadRuneSlice()
	n := len(S)

	for i := 0; i < n; i++ {
		if S[i] == 'm' || S[i] == 'w' {
			fmt.Println(0)
			return
		}
	}

	dp[0][0] = 1
	for i := 0; i < n; i++ {
		dp[i+1][0] += dp[i][0] + dp[i][1]
		dp[i+1][0] %= MOD

		if i == 0 {
			continue
		}

		if S[i] == 'u' && S[i-1] == 'u' {
			dp[i+1][1] += dp[i][0]
			dp[i+1][1] %= MOD
		} else if S[i] == 'n' && S[i-1] == 'n' {
			dp[i+1][1] += dp[i][0]
			dp[i+1][1] %= MOD
		}
	}

	ans := dp[n][0] + dp[n][1]
	ans %= MOD
	fmt.Println(ans)
}

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

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

package main

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

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

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	const mod int64 = 1e9 + 7

	var s string
	Fscan(in, &s)
	n := len(s)

	f := make([]int64, n+10)
	f[0] = 1
	f[1] = 1
	for i := 2; i <= n; i++ {
		f[i] = (f[i-1] + f[i-2]) % mod
	}

	ans := int64(1)
	for i := 0; i < n; {
		if s[i] == 'm' || s[i] == 'w' {
			Fprintln(out, 0)
			return
		}
		if s[i] == 'n' {
			j := i + 1
			for ; j < n; j++ {
				if s[j] != 'n' {
					break
				}
			}
			cnt := j - i
			ans = ans * f[cnt] % mod
			i = j
		} else if s[i] == 'u' {
			j := i + 1
			for ; j < n; j++ {
				if s[j] != 'u' {
					break
				}
			}
			cnt := j - i
			ans = ans * f[cnt] % mod
			i = j

		} else {
			i++
		}
	}
	Fprintln(out, ans)
}

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

package main

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

type point struct {
	x, y int
}

var ans int64

const (
	mod = int(1e9 + 7)
)

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	tt := 1
	//fmt.Fscanf(in, "%d\n", &tt)
	mod := int64(1e9 + 7)
	for ii := 0; ii < tt; ii++ {
		s := ""
		fmt.Fscanf(in, "%s\n", &s)
		n := len(s)
		f := make([]int64, n+4)
		f[0] = 1
		f[1] = 1
		f[2] = 2
		for i := 3; i <= n; i++ {
			f[i] = f[i-1] + f[i-2]
			f[i] %= mod
		}
		ans := int64(1)
		for len(s) > 0 {
			if s[0] == 'n' || s[0] == 'u' {
				cur := s[0]
				cnt := 0
				for len(s) > 0 && s[0] == cur {
					s = s[1:]
					cnt++
				}
				ans *= f[cnt]
				ans %= mod
			} else if s[0] == 'm' || s[0] == 'w' {
				ans = 0
				break
			} else {
				s = s[1:]
			}
		}
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}

func solve(n string) string {
	a := []int{}
	b := []int{}
	for i := 0; i < len(n); i++ {
		cur := int(n[i] - '0')
		if cur%2 == 0 {
			a = append(a, cur)
		} else {
			b = append(b, cur)
		}
	}
	ans := []byte{}
	for len(a)+len(b) > 0 {
		if len(a) == 0 {
			ans = append(ans, '0'+byte(b[0]))
			b = b[1:]
		} else if len(b) == 0 {
			ans = append(ans, '0'+byte(a[0]))
			a = a[1:]
		} else if a[0] < b[0] {
			ans = append(ans, '0'+byte(a[0]))
			a = a[1:]
		} else {
			ans = append(ans, '0'+byte(b[0]))
			b = b[1:]
		}
	}
	return string(ans)
}

func help(i int, n int, total int, t []int, g []int, cur int, c1, c2, c3 int, remaining int) {
	//fmt.Println(i, cur)
	if i == n {
		if cur == total {
			cal(c1, c2, c3)
		}
		return
	}
	if cur > total {
		return
	}
	if cur+remaining < total {
		return
	}
	switch g[i] {
	case 1:
		help(i+1, n, total, t, g, cur+t[i], c1+1, c2, c3, remaining-t[i])
	case 2:
		help(i+1, n, total, t, g, cur+t[i], c1, c2+1, c3, remaining-t[i])
	case 3:
		help(i+1, n, total, t, g, cur+t[i], c1, c2, c3+1, remaining-t[i])
	}
	help(i+1, n, total, t, g, cur, c1, c2, c3, remaining-t[i])
}

func cal(c1, c2, c3 int) {
	a := []int{c1, c2, c3}
	sort.Ints(a)
	tmp := int64(try(c1, c2, c3, 0))
	tmp %= int64(mod)
	for i := 1; i <= c1; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	for i := 1; i <= c2; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	for i := 1; i <= c3; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	ans += tmp
	ans %= int64(mod)
}

func try(a, b, c int, last int) int64 {
	if a == 0 && b == 0 && c == 0 {
		return 1
	}
	if a < 0 || b < 0 || c < 0 {
		return 0
	}
	if last == 0 {
		return try(a-1, b, c, 1) + try(a, b-1, c, 2) + try(a, b, c-1, 3)
	}
	if last == 1 {
		return try(a, b-1, c, 2) + try(a, b, c-1, 3)
	}
	if last == 2 {
		return try(a-1, b, c, 1) + try(a, b, c-1, 3)
	}
	return try(a-1, b, c, 1) + try(a, b-1, c, 2)
}

package main

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

// w =>> uu
// m =>> nn
const MOD = 1000000007

func main() {
	defer out.Flush()
	s := ScanWord()
	P(solv(s))
}

func solv(s string) int {
	if s[0] == 'm' || s[0] == 'w' {
		return 0
	}
	if len(s) > 1 && (s[0] == 'm' || s[1] == 'w') {
		return 0
	}
	dp := make([]int, len(s)+1)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= len(s); i++ {
		if s[i-1] == 'm' || s[i-1] == 'w' {
			return 0
		}

		dp[i] = dp[i-1]
		if (s[i-1] == 'n' && s[i-2] == 'n') || (s[i-1] == 'u' && s[i-2] == 'u') {
			dp[i] = (dp[i-2] + dp[i]) % MOD
		}
	}
	return dp[len(s)]
}

/*********************** I/O ***********************/
var in *bufio.Scanner
var out *bufio.Writer

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)
	out = bufio.NewWriter(os.Stdout)
}

func P(args ...interface{}) {
	print("\n", args...)
}

func PS(args ...interface{}) {
	print(" ", args...)
	print("\n", nil)
}

func print(seperator string, args ...interface{}) {
	for _, arg := range args {
		str := ""
		switch v := arg.(type) {
		case byte:
			str = string(v)
		case rune:
			str = string(v)
		case int:
			str = strconv.Itoa(v)
		case []int:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.Itoa(v[i]) + " ")
			}
			str = sb.String()
		case int64:
			str = strconv.FormatInt(v, 10)
		case []int64:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.FormatInt(v[i], 10) + " ")
			}
			str = sb.String()
		case string:
			str = v
		default:
			panic("invalid print arg: " + fmt.Sprintf("%v", arg))

		}
		out.WriteString(str + seperator)
	}
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanWords(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanInt() int { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ScanInt()
	}
	return a
}

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
}
func Mn(args ...int) int { mn, _ := MnMx(args...); return mn }
func Mx(args ...int) int { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int   { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

// w =>> uu
// m =>> nn
const MOD = 1000000007

func main() {
	defer out.Flush()
	s := ScanWord()
	P(solv(s))
}

func solv(s string) int {
	if s[0] == 'm' || s[0] == 'w' {
		return 0
	}
	if len(s) > 1 && (s[0] == 'm' || s[1] == 'w') {
		return 0
	}
	dp := make([]int, len(s)+1)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= len(s); i++ {
		if s[i-1] == 'm' || s[i-1] == 'w' {
			return 0
		}
		if (s[i-1] == 'n' && s[i-2] == 'n') || (s[i-1] == 'u' && s[i-2] == 'u') {
			dp[i] = (dp[i-2] + dp[i-1]) % MOD
		} else {
			dp[i] = dp[i-1]
		}
	}
	return dp[len(s)]
}

/*********************** I/O ***********************/
var in *bufio.Scanner
var out *bufio.Writer

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)
	out = bufio.NewWriter(os.Stdout)
}

func P(args ...interface{}) {
	print("\n", args...)
}

func PS(args ...interface{}) {
	print(" ", args...)
	print("\n", nil)
}

func print(seperator string, args ...interface{}) {
	for _, arg := range args {
		str := ""
		switch v := arg.(type) {
		case byte:
			str = string(v)
		case rune:
			str = string(v)
		case int:
			str = strconv.Itoa(v)
		case []int:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.Itoa(v[i]) + " ")
			}
			str = sb.String()
		case int64:
			str = strconv.FormatInt(v, 10)
		case []int64:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.FormatInt(v[i], 10) + " ")
			}
			str = sb.String()
		case string:
			str = v
		default:
			panic("invalid print arg: " + fmt.Sprintf("%v", arg))

		}
		out.WriteString(str + seperator)
	}
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanWords(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanInt() int { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ScanInt()
	}
	return a
}

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
}
func Mn(args ...int) int { mn, _ := MnMx(args...); return mn }
func Mx(args ...int) int { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int   { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

const N = 100010
const mod  = 1000000007
var dp[N] int

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var s string
	fmt.Fscanf(reader, "%s", &s)
	var have = false
	for _, c := range s{
		if c == 'm' || c == 'w' {
			have = true
		}
	}

	if have {
		fmt.Fprintf(writer, "0")
		return
	}

	var n = len(s)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= n; i++ {
		dp[i] = dp[i - 1]
		if s[i - 1] == 'u' && s[i - 1] == s[i - 2] {
			dp[i] += dp[i - 2]
			dp[i] %= mod
		}

		if s[i - 1] == 'n' && s[i - 1] == s[i - 2] {
			dp[i] += dp[i - 2]
			dp[i] %= mod
		}
	}

	fmt.Fprintf(writer, "%d\n", dp[n])
}

package main

import (
	"fmt"

)

import s "strings"

var str string

var count int = 1

func main() {
	fmt.Scanf("%s", &str)
	if s.Contains(str, "m") || s.Contains(str, "w"){
		print(0)
		return
	}

	var dp [10001]int
	dp[0] = 1
	dp[1] = 1
	if str[1] == 'n' && str[0] == 'n' || str[1] == 'u' && str[0] == 'u'{
		dp[1] = 2
	}

	i:= 2

	for ; i<len(str);i++ {
		if str[i] == str[i-1] && str[i] == 'n' || str[i] == str[i-1] && str[i] == 'u'{
			dp[i] = dp[i-1] + dp[i-2]
		}else{
			dp[i] = dp[i-1]
		}
	}
	println(dp[len(str)-1])
}

package main

import (
	"fmt"

)

import s "strings"

var str string

var count int = 1

func main() {
	fmt.Scanf("%s", &str)
	if s.Contains(str, "m") || s.Contains(str, "w"){
		print(0)
		return
	}

	var dp [10001]int
	dp[0] = 1
	dp[1] = 1
	if str[1] == 'n' && str[0] == 'n' || str[1] == 'u' && str[0] == 'u'{
		dp[1] = 2
	}

	i:= 2

	for ; i<len(str);i++ {
		if str[i] == str[i-1] && str[i] == 'n' || str[i] == str[i-1] && str[i] == 'u'{
			dp[i] = dp[i-1] + dp[i-2]
		}else{
			dp[i] = dp[i-1]
		}
	}
	fmt.Printf("%d", dp[len(str)-1])
}

package main

import (
	"fmt"

)

import s "strings"

var str string

var count int = 1

func main() {
	fmt.Scanf("%s", &str)
	if s.Contains(str, "m") || s.Contains(str, "w"){
		print(0)
		return
	}

	var dp [10001]int
	dp[0] = 1
	dp[1] = 1
	if str[1] == 'n' && str[0] == 'n' || str[1] == 'u' && str[0] == 'u'{
		dp[1] = 2
	}

	i:= 2

	for ; i<len(str);i++ {
		if str[i] == str[i-1] && str[i] == 'n' || str[i] == str[i-1] && str[i] == 'u'{
			dp[i] = dp[i-1] + dp[i-2]
		}else{
			dp[i] = dp[i-1]
		}
	}
	print(dp[len(str)-1])
}

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+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// 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())
}

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

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

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

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

	return s
}

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

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

var S []rune
var dp [100000 + 5][2]int64

func main() {
	S = ReadRuneSlice()
	n := len(S)

	for i := 0; i < n; i++ {
		if S[i] == 'm' || S[i] == 'w' {
			fmt.Println(0)
			return
		}
	}

	dp[0][0] = 1
	for i := 0; i < n; i++ {
		dp[i+1][0] += dp[i][0] + dp[i][1]
		dp[i+1][0] %= MOD

		if i == 0 {
			continue
		}

		if S[i] == 'u' && S[i-1] == 'u' {
			dp[i+1][1] += dp[i][0]
			dp[i+1][1] %= MOD
		} else if S[i] == 'n' && S[i-1] == 'n' {
			dp[i+1][1] += dp[i][0]
			dp[i+1][1] %= MOD
		}
	}

	fmt.Println(dp[n][0] + dp[n][1])
}

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

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

package main

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

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

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	const mod int64 = 1e9+7

	var s string
	Fscan(in, &s)
	n := len(s)

	f := make([]int64, n+10)
	f[1] = 1
	for i := 2;i<=n;i++ {
		f[n]=(f[n-1]+f[n-2]) %mod
	}

	ans := int64(1)
	for i := 0; i < n; {
		if s[i] == 'm' || s[i] == 'w' {
			Fprintln(out, 0)
			return
		}
		if s[i] == 'n' {
			j := i+1
			for ;j<n;j++ {
				if s[j] !='n' {
					break
				}
			}
			cnt := j-i
			ans =ans*int64(cnt)%mod
			i = j
		} else if s[i] == 'u' {
			j := i+1
			for ;j<n;j++ {
				if s[j] !='u' {
					break
				}
			}
			cnt := j-i
			ans =ans*int64(cnt)%mod
			i = j

		} else {
			i++
		}
	}
	Fprintln(out, ans)
}

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

package main

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

// w =>> uu
// m =>> nn
const MOD = 1000000007

func main() {
	defer out.Flush()
	s := ScanWord()
	P(solv(s))
}

func solv(s string) int {
	if s[0] == 'm' || s[0] == 'w' {
		return 0
	}

	dp := make([]int, len(s)+1)
	dp[0] = 1
	for i := 1; i < len(s); i++ {
		if s[i] == 'm' || s[i] == 'w' {
			return 0
		} else if s[i] == 'n' && s[i-1] == 'n' {
			dp[i] = (dp[i-1] * 2) % MOD
		} else if s[i] == 'u' && s[i-1] == 'u' {
			dp[i] = (dp[i-1] * 2) % MOD
		} else {
			dp[i] = dp[i-1]
		}
	}
	return dp[len(s)-1]
}

/*********************** I/O ***********************/
var in *bufio.Scanner
var out *bufio.Writer

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)
	out = bufio.NewWriter(os.Stdout)
}

func P(args ...interface{}) {
	print("\n", args...)
}

func PS(args ...interface{}) {
	print(" ", args...)
	print("\n", nil)
}

func print(seperator string, args ...interface{}) {
	for _, arg := range args {
		str := ""
		switch v := arg.(type) {
		case byte:
			str = string(v)
		case rune:
			str = string(v)
		case int:
			str = strconv.Itoa(v)
		case []int:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.Itoa(v[i]) + " ")
			}
			str = sb.String()
		case int64:
			str = strconv.FormatInt(v, 10)
		case []int64:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.FormatInt(v[i], 10) + " ")
			}
			str = sb.String()
		case string:
			str = v
		default:
			panic("invalid print arg: " + fmt.Sprintf("%v", arg))

		}
		out.WriteString(str + seperator)
	}
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanWords(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanInt() int { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ScanInt()
	}
	return a
}

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
}
func Mn(args ...int) int { mn, _ := MnMx(args...); return mn }
func Mx(args ...int) int { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int   { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

// w =>> uu
// m =>> nn
const MOD = 1000000007

func main() {
	defer out.Flush()
	s := ScanWord()
	P(solv(s))
}

func solv(s string) int {
	dp := make([]int, len(s)+1)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= len(s); i++ {
		if s[i-1] == 'm' || s[i-1] == 'w' {
			return 0
		}
		if (s[i-1] == 'n' && s[i-2] == 'n') || (s[i-1] == 'u' && s[i-2] == 'u') {
			dp[i] = (dp[i-2] + dp[i-1]) % MOD
		} else {
			dp[i] = dp[i-1]
		}
	}
	return dp[len(s)]
}

/*********************** I/O ***********************/
var in *bufio.Scanner
var out *bufio.Writer

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)
	out = bufio.NewWriter(os.Stdout)
}

func P(args ...interface{}) {
	print("\n", args...)
}

func PS(args ...interface{}) {
	print(" ", args...)
	print("\n", nil)
}

func print(seperator string, args ...interface{}) {
	for _, arg := range args {
		str := ""
		switch v := arg.(type) {
		case byte:
			str = string(v)
		case rune:
			str = string(v)
		case int:
			str = strconv.Itoa(v)
		case []int:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.Itoa(v[i]) + " ")
			}
			str = sb.String()
		case int64:
			str = strconv.FormatInt(v, 10)
		case []int64:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.FormatInt(v[i], 10) + " ")
			}
			str = sb.String()
		case string:
			str = v
		default:
			panic("invalid print arg: " + fmt.Sprintf("%v", arg))

		}
		out.WriteString(str + seperator)
	}
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanWords(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanInt() int { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ScanInt()
	}
	return a
}

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
}
func Mn(args ...int) int { mn, _ := MnMx(args...); return mn }
func Mx(args ...int) int { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int   { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

const N = 100010
const mod  = 1000000007
var dp[N] int

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var s string
	fmt.Fscanf(reader, "%s", &s)
	var n = len(s)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= n; i++ {
		dp[i] = dp[i - 1]
		if s[i - 1] == 'u' && s[i - 1] == s[i - 2] {
			dp[i] += dp[i - 2]
			dp[i] %= mod
		}

		if s[i - 1] == 'n' && s[i - 1] == s[i - 2] {
			dp[i] += dp[i - 2]
			dp[i] %= mod
		}
	}

	fmt.Fprintf(writer, "%d\n", dp[n])
}


Polycarp has a string $$$s$$$. Polycarp performs the following actions until the string $$$s$$$ is empty ($$$t$$$ is initially an empty string):  he adds to the right to the string $$$t$$$ the string $$$s$$$, i.e. he does $$$t = t + s$$$, where $$$t + s$$$ is a concatenation of the strings $$$t$$$ and $$$s$$$;  he selects an arbitrary letter of $$$s$$$ and removes from $$$s$$$ all its occurrences (the selected letter must occur in the string $$$s$$$ at the moment of performing this action). Polycarp performs this sequence of actions strictly in this order.Note that after Polycarp finishes the actions, the string $$$s$$$ will be empty and the string $$$t$$$ will be equal to some value (that is undefined and depends on the order of removing).E.g. consider $$$s$$$="abacaba" so the actions may be performed as follows:  $$$t$$$="abacaba", the letter 'b' is selected, then $$$s$$$="aacaa";  $$$t$$$="abacabaaacaa", the letter 'a' is selected, then $$$s$$$="c";  $$$t$$$="abacabaaacaac", the letter 'c' is selected, then $$$s$$$="" (the empty string). You need to restore the initial value of the string $$$s$$$ using only the final value of $$$t$$$ and find the order of removing letters from $$$s$$$.

The first line contains one integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Then $$$T$$$ test cases follow. Each test case contains one string $$$t$$$ consisting of lowercase letters of the Latin alphabet. The length of $$$t$$$ doesn't exceed $$$5 \cdot 10^5$$$. The sum of lengths of all strings $$$t$$$ in the test cases doesn't exceed $$$5 \cdot 10^5$$$.

For each test case output in a separate line:   $$$-1$$$, if the answer doesn't exist;  two strings separated by spaces. The first one must contain a possible initial value of $$$s$$$. The second one must contain a sequence of letters — it's in what order one needs to remove letters from $$$s$$$ to make the string $$$t$$$. E.g. if the string "bac" is outputted, then, first, all occurrences of the letter 'b' were deleted, then all occurrences of 'a', and then, finally, all occurrences of 'c'. If there are multiple solutions, print any one.

7
abacabaaacaac
nowyouknowthat
polycarppoycarppoyarppyarppyrpprppp
isi
everywherevrywhrvryhrvrhrvhv
haaha
qweqeewew

abacaba bac
-1
polycarp lcoayrp
is si
everywhere ewyrhv
-1
-1

NoteThe first test case is considered in the statement.

package main

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

func main() {
	var t int
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var s []byte
		fmt.Fscan(in,&s)
		mp := map[byte]int{}
		cool := []byte{}
		for i:=len(s)-1;i>=0;i--{
			if mp[s[i]]==0{
				mp[s[i]]=1
				cool = append([]byte{s[i]},cool...)
			}
		}
		cnt := map[byte]int{}
		for i:=0;i<len(s);i++{
			cnt[s[i]]++
		}
		flag := true
		word := map[byte]int{}
		for i:=0;i<len(cool);i++{
			x := i+1
			if cnt[cool[i]]%x!=0{
				flag = false
				break
			}
			word[cool[i]]=cnt[cool[i]]/x
		}
		if !flag{
			fmt.Fprintln(out,-1)
			continue
		}
		ret := []byte{}
		for i:=0;i<len(s);i++{
			word[s[i]]--
			ret = append(ret,s[i])
			check:=false
			for _,v :=range word{
				if v!=0{
					check=true
				}
			}
			if !check{
				break
			}
		}
		sb := string(ret)
		dis := 0
		good := true
		for i:=0;i<len(cool);i++{
			l := strings.Split(sb,string(cool[i]))
			temp := ""
			for j:=0;j<len(l);j++{
				temp = temp + l[j]
			}
			if len(sb)+dis+len(temp)>len(s)||strings.Compare(string(s[(len(sb)+dis):(len(sb)+dis)+len(temp)]),temp)!=0{
				good = false
				break
			}
			dis += len(sb)
			sb = temp
		}
		if !good{
			fmt.Fprintln(out,-1)
		}else{
			fmt.Fprintf(out,"%s %s\n",string(ret),string(cool))
		}
	}
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

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

	for i := 0; i < t; i++ {
		var str string
		fmt.Fscan(r, &str)

		r, a, b := solve(str)

		if r {
			fmt.Print(a)
			fmt.Print(" ")
			fmt.Print(b)
			fmt.Println()
		} else {
			fmt.Println("-1")
		}
	}
}

func solve(t string) (bool, string, string) {
	//abcdbabccbd - a = bcdbbccbd

	//abcdbabccbdbcdbbccbd - b = cdccd
	//abcdbabccbdbcdbbccbdcdccd - c = dd
	//abcdbabccbdbcdbbccbdcdccddd - d = ""
	//abcdbabccbdbcdbbccbdcdccddd

 	mp := make(map[byte]int)

 	seen := make([]bool, 27)
 	var order []byte

 	for i := len(t) - 1; i >= 0; i-- {
 		mp[t[i]]++
 		if seen[t[i] - 'a'] {
 			continue
		}
		seen[t[i] - 'a'] = true
		order = append(order, t[i])
	}

	most := order[0]
	//appr := math.Sqrt(float64(mp[most]))
	count := mp[most]

	for i := 1; i <= mp[most]; i++ {
		if count % i != 0 {
			continue
		}
		d := count/i

		if d > len(order) {
			continue
		}

		ok := true

		for j := 1; j < len(order); j++ {

			if d == 1 {
				ok = false
				break
			}

			letter := order[j]
			fr := mp[letter]

			if fr % (d - 1) != 0 {
				ok = false
				break
			}
			d--
		}

		if ok {
			temp := count/i
			counts := make(map[byte]int)
			counts[order[0]] = i
			temp--

			for i := 1; i < len(order); i++ {
				c := mp[order[i]]/temp
				counts[order[i]] = c

				temp--
			}

			var in bytes.Buffer

			good := true

			var i int
			for i = 0; i < len(t); i++ {
				if counts[t[i]] <= 0 {
					for _, v := range counts {
						if v > 0 {
							good = false
							break
						}
					}
					break
				}

				in.WriteByte(t[i])
				counts[t[i]]--
			}

			if !good {
				continue
			}

			str := in.String()

			var tot bytes.Buffer
			tot.WriteString(str)

			seen := make([]bool, 27)

			for i := len(order) - 1; i >= 0; i-- {
				seen[order[i] - 'a']= true

				for k := 0; k < len(str); k++ {
					if seen[str[k] - 'a'] {
						continue
					}
					tot.WriteByte(str[k])
				}
			}

			if t == tot.String() {

				var o bytes.Buffer
				for i := len(order) - 1; i >= 0; i--{
					o.WriteByte(order[i])
				}

				return true, str, o.String()
			}
		}
	}

	return false, "", ""
}

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

package main

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

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

	var T int
	var t []byte
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &t)
		n := len(t)
		del := []byte{}
		vis := 0
		for i := n - 1; i >= 0; i-- {
			if b := t[i]; 1<<(b-'a')&vis == 0 {
				vis |= 1 << (b - 'a')
				del = append(del, b)
			}
		}
		m := len(del)
		for i := 0; i < m/2; i++ {
			del[i], del[m-1-i] = del[m-1-i], del[i]
		}
		p := bytes.LastIndexByte(t, del[0]) + 1
		ex := 0
		for i := 1; i < m; i++ {
			ex += i * bytes.Count(t[:p], del[i:i+1])
		}
		for ; p+ex < n; p++ {
			ex += bytes.IndexByte(del, t[p])
		}
		if p+ex > n {
			Fprintln(out, -1)
			continue
		}
		s := t[:p]
		t2 := make([]byte, 0, n)
		t2 = append(t2, s...)
		for i := range del {
			s = bytes.ReplaceAll(s, del[i:i+1], nil)
			t2 = append(t2, s...)
		}
		if bytes.Compare(t2, t) != 0 {
			Fprintln(out, -1)
		} else {
			Fprintf(out, "%s %s\n", t[:p], del)
		}
	}
}

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

package main

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

func main() {
	in := NewIn()
	out := NewOut()
	defer out.flush()

	run(in, out)
}

func run(in *In, out *Out) {
	cases(in, out)
	// solve(in, out)
}

/* --- Solution E --- */
func solve(in *In, out *Out) {
	s := in.next()
	n := len(s)

	var decrypt func() (string, []byte)
	decrypt = func() (string, []byte) {
		freq := map[byte]int{}
		revOrder := []byte{}

		for i := n - 1; i > -1; i-- {
			if freq[s[i]] == 0 {
				revOrder = append(revOrder, s[i])
			}
			freq[s[i]]++
		}

		k := len(revOrder)
		origLen := 0
		for i := 0; i < k; i++ {
			origLen += freq[revOrder[i]] / (k - i)
		}

		return s[:origLen], revOrder
	}

	var encrypt func(string, []byte) string
	encrypt = func(orig string, revOrder []byte) string {
		res := []byte(orig)
		for i := len(revOrder) - 1; i > -1; i-- {
			temp := []byte{}
			for j := 0; j < len(orig); j++ {
				if orig[j] != revOrder[i] {
					res = append(res, orig[j])
					temp = append(temp, orig[j])
				}
			}
			orig = string(temp)
		}
		return string(res)
	}

	orig, revOrder := decrypt()
	if encrypt(orig, revOrder) != s {
		out.println(-1)
	} else {
		out.printf("%s ", orig)
		for i := len(revOrder) - 1; i > -1; i-- {
			out.printf("%c", revOrder[i])
		}
		out.println()
	}

}

func cases(in *In, out *Out) {
	t := in.nextInt()
	for ; t > 0; t-- {
		solve(in, out)
	}
}

/* --- I/O --- */
const BUF_MAX_CAP int = 1e7

type In struct {
	scanner *bufio.Scanner
}

func NewIn() *In {
	scn := bufio.NewScanner(os.Stdin)

	buf := make([]byte, BUF_MAX_CAP)
	scn.Buffer(buf, BUF_MAX_CAP)
	scn.Split(bufio.ScanWords)

	return &In{scn}
}

func (in *In) nextInt() int {
	in.scanner.Scan()
	i, _ := strconv.Atoi(in.scanner.Text())
	return i
}

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

func (in *In) nextDouble() float64 {
	in.scanner.Scan()
	i, _ := strconv.ParseFloat(in.scanner.Text(), 64)
	return i
}

func (in *In) next() string {
	in.scanner.Scan()
	return in.scanner.Text()
}

type Out struct {
	writer *bufio.Writer
}

func NewOut() *Out {
	out := Out{bufio.NewWriter(os.Stdout)}
	return &out
}

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

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

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

func (out *Out) flush() {
	out.writer.Flush()
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t int
	var s string
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &s)
		w1, w2, w3 := do(s)
		if w3 {
			fmt.Fprint(w, w1, " ", w2)
		} else {
			fmt.Fprint(w, -1)
		}
		fmt.Fprintln(w)
	}
}

func do(t string) (string, string, bool) {
	m := map[byte]int{}
	var d string
	for i := len(t) - 1; i >= 0; i-- {
		m[t[i]]++
		if m[t[i]] == 1 {
			d = string(t[i]) + d
		}
	}
	l := 0
	for i := range d {
		if m[d[i]]%(i+1) != 0 {
			return "", "", false
		}
		l += m[d[i]] / (i + 1)
	}
	s := t[:l]
	a := 0
	b := l
	for i := range d {
		l -= (m[d[i]] / (i + 1))
		c := b + l
		if !chk(t[a:b], t[b:c], d[i]) {
			return "", "", false
		}
		a, b = b, c
	}
	return s, d, true
}

func chk(a, b string, c byte) bool {
	var i, j int
	for i < len(a) && j < len(b) {
		if a[i] == c {
			i++
			continue
		}
		if a[i] != b[j] {
			return false
		}
		i++
		j++
	}
	for i < len(a) && a[i] == c {
		i++
	}
	return i >= len(a) && j >= len(b)
}

package main

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

func main() {
	var t int
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var s []byte
		fmt.Fscan(in,&s)
		mp := map[byte]int{}
		cool := []byte{}
		for i:=len(s)-1;i>=0;i--{
			if mp[s[i]]==0{
				mp[s[i]]=1
				cool = append([]byte{s[i]},cool...)
			}
		}
		cnt := map[byte]int{}
		for i:=0;i<len(s);i++{
			cnt[s[i]]++
		}
		flag := true
		word := map[byte]int{}
		for i:=0;i<len(cool);i++{
			x := i+1
			if cnt[cool[i]]%x!=0{
				flag = false
				break
			}
			word[cool[i]]=cnt[cool[i]]/x
		}
		if !flag{
			fmt.Fprintln(out,-1)
			continue
		}
		ret := []byte{}
		for i:=0;i<len(s);i++{
			word[s[i]]--
			ret = append(ret,s[i])
			check:=false
			for _,v :=range word{
				if v!=0{
					check=true
				}
			}
			if !check{
				break
			}
		}
		sb := string(ret)
		dis := 0
		good := true
		for i:=0;i<len(cool);i++{
			l := strings.Split(sb,string(cool[i]))
			temp := ""
			for j:=0;j<len(l);j++{
				temp = temp + l[j]
			}
			fmt.Println(temp)
			if len(sb)+dis+len(temp)>len(s)||strings.Compare(string(s[(len(sb)+dis):(len(sb)+dis)+len(temp)]),temp)!=0{
				good = false
				break
			}
			dis += len(sb)
			sb = temp
		}
		if !good{
			fmt.Fprintln(out,-1)
		}else{
			fmt.Fprintf(out,"%s %s\n",string(ret),string(cool))
		}
	}
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

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

	for i := 0; i < t; i++ {
		var str string
		fmt.Fscan(r, &str)

		r, a, b := solve(str)

		if r {
			fmt.Print(a)
			fmt.Print(" ")
			fmt.Print(b)
			fmt.Println()
		} else {
			fmt.Println("-1")
		}
	}
}

func solve(t string) (bool, string, string) {
	//abcdbabccbd - a = bcdbbccbd

	//abcdbabccbdbcdbbccbd - b = cdccd
	//abcdbabccbdbcdbbccbdcdccd - c = dd
	//abcdbabccbdbcdbbccbdcdccddd - d = ""
	//abcdbabccbdbcdbbccbdcdccddd

 	mp := make(map[byte]int)

 	seen := make([]bool, 27)
 	var order []byte

 	for i := len(t) - 1; i >= 0; i-- {
 		mp[t[i]]++
 		if seen[t[i] - 'a'] {
 			continue
		}
		seen[t[i] - 'a'] = true
		order = append(order, t[i])
	}

	most := order[0]
	appr := math.Sqrt(float64(mp[most]))
	count := mp[most]

	for i := 1; i < int(appr) + 10; i++ {
		if count % i != 0 {
			continue
		}
		d := count/i

		if d > len(order) {
			continue
		}

		ok := true

		for j := 1; j < len(order); j++ {

			if d == 1 {
				ok = false
				break
			}

			letter := order[j]
			fr := mp[letter]

			if fr % (d - 1) != 0 {
				ok = false
				break
			}
			d--
		}

		if ok {
			temp := count/i
			counts := make(map[byte]int)
			counts[order[0]] = i
			temp--

			for i := 1; i < len(order); i++ {
				c := mp[order[i]]/temp
				counts[order[i]] = c

				temp--
			}

			var in bytes.Buffer

			good := true

			var i int
			for i = 0; i < len(t); i++ {
				if counts[t[i]] <= 0 {
					for _, v := range counts {
						if v > 0 {
							good = false
							break
						}
					}
					break
				}

				in.WriteByte(t[i])
				counts[t[i]]--
			}

			if !good {
				continue
			}

			str := in.String()

			var tot bytes.Buffer
			tot.WriteString(str)

			seen := make([]bool, 27)

			for i := len(order) - 1; i >= 0; i-- {
				seen[order[i] - 'a']= true

				for k := 0; k < len(str); k++ {
					if seen[str[k] - 'a'] {
						continue
					}
					tot.WriteByte(str[k])
				}
			}

			if t == tot.String() {

				var o bytes.Buffer
				for i := len(order) - 1; i >= 0; i--{
					o.WriteByte(order[i])
				}

				return true, str, o.String()
			}
		}
	}

	return false, "", ""
}

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


Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.Zhorik knows that each of the messages is an archive containing one or more files. Zhorik knows how each of these archives was transferred through the network: if an archive consists of k files of sizes l1, l2, ..., lk bytes, then the i-th file is split to one or more blocks bi, 1, bi, 2, ..., bi, mi (here the total length of the blocks bi, 1 + bi, 2 + ... + bi, mi is equal to the length of the file li), and after that all blocks are transferred through the network, maintaining the order of files in the archive.Zhorik thinks that the two messages contain the same archive, because their total lengths are equal. However, each file can be split in blocks in different ways in the two messages.You are given the lengths of blocks in each of the two messages. Help Zhorik to determine what is the maximum number of files could be in the archive, if the Zhorik's assumption is correct.

The first line contains two integers n, m (1 ≤ n, m ≤ 105) — the number of blocks in the first and in the second messages. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 106) — the length of the blocks that form the first message. The third line contains m integers y1, y2, ..., ym (1 ≤ yi ≤ 106) — the length of the blocks that form the second message. It is guaranteed that x1 + ... + xn = y1 + ... + ym. Also, it is guaranteed that x1 + ... + xn ≤ 106.

Print the maximum number of files the intercepted array could consist of.

NoteIn the first example the maximum number of files in the archive is 3. For example, it is possible that in the archive are three files of sizes 2 + 5 = 7, 15 = 3 + 1 + 11 = 8 + 2 + 4 + 1 and 4 + 4 = 8.In the second example it is possible that the archive contains two files of sizes 1 and 110 = 10 + 100 = 100 + 10. Note that the order of files is kept while transferring archives through the network, so we can't say that there are three files of sizes 1, 10 and 100.In the third example the only possibility is that the archive contains a single file of size 4.

package main

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

var cs map[int]int = make(map[int]int)

func Init() {}
func Solve(io *FastIO) {
	n := io.NextInt()
	m := io.NextInt()
	a := io.NextIntArray(n)
	b := io.NextIntArray(m)
	s1, s2 := 0, 0
	o := 0
	i, j := 0, 0
	for i < n || j < m {
		if s1 <= s2 && i < n {
			s1 += a[i]
			i++
		} else {
			s2 += b[j]
			j++
		}
		if s1 == s2 {
			o++
		}
		//io.Println(o, s1, s2)
	}
	io.Println(o)
}

type FastIO struct {
	//by megaspazz
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}
func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = res*10 + int(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = int64(-1)
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = res*10 + int64(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}
func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}
func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}
func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}
func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}
func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}
func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}
func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}
func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}
func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}
func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}
func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them.Consider two dices. When thrown each dice shows some integer from 1 to n inclusive. For each dice the probability of each outcome is given (of course, their sum is 1), and different dices may have different probability distributions.We throw both dices simultaneously and then calculate values max(a, b) and min(a, b), where a is equal to the outcome of the first dice, while b is equal to the outcome of the second dice. You don't know the probability distributions for particular values on each dice, but you know the probability distributions for max(a, b) and min(a, b). That is, for each x from 1 to n you know the probability that max(a, b) would be equal to x and the probability that min(a, b) would be equal to x. Find any valid probability distribution for values on the dices. It's guaranteed that the input data is consistent, that is, at least one solution exists.

First line contains the integer n (1 ≤ n ≤ 100 000) — the number of different values for both dices. Second line contains an array consisting of n real values with up to 8 digits after the decimal point  — probability distribution for max(a, b), the i-th of these values equals to the probability that max(a, b) = i. It's guaranteed that the sum of these values for one dice is 1. The third line contains the description of the distribution min(a, b) in the same format.

Output two descriptions of the probability distribution for a on the first line and for b on the second line.  The answer will be considered correct if each value of max(a, b) and min(a, b) probability distribution values does not differ by more than 10 - 6 from ones given in input. Also, probabilities should be non-negative and their sums should differ from 1 by no more than 10 - 6.

package main

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

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

func readString() string {
	if !in.Scan() {
		panic(in.Err())
	}
	return in.Text()
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return i
}

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

func readFloats(n int) []float64 {
	s := make([]float64, n)
	for i := range s {
		s[i] = readFloat()
	}
	return s
}

func main() {
	in.Split(bufio.ScanWords)
	defer out.Flush()

	n := readInt()
	max := readFloats(n)
	min := readFloats(n)

	x := make([]float64, n)
	y := make([]float64, n)

	sx := 0.
	sy := 0.
	for i := range x {
		b := sx - sy - max[i] - min[i]
		d := b * b - 4*((1 - sx) * max[i] - sx * min[i])
		if d < 0 {
			d = 0
		}
		x[i] = (-b + math.Sqrt(d)) / 2
		y[i] = (max[i] - x[i] * sy) / (sx + x[i])
		sx += x[i]
		sy += y[i]
	}
	write(x)
	write(y)
}

func write(s []float64) {
	for i := range s {
		fmt.Fprintf(out, "%.9f", s[i])
		if i + 1 != len(s) {
			out.WriteByte(' ')
		} else {
			out.WriteByte('\n')
		}
	}
}

package main

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

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

func readString() string {
	if !in.Scan() {
		panic(in.Err())
	}
	return in.Text()
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return i
}

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

func readFloats(n int) []float64 {
	s := make([]float64, n)
	for i := range s {
		s[i] = readFloat()
	}
	return s
}

func main() {
	in.Split(bufio.ScanWords)
	defer out.Flush()

	n := readInt()
	max := readFloats(n)
	min := readFloats(n)

	x := make([]float64, n)
	y := make([]float64, n)

	sx := 0.
	sy := 0.
	for i := range x {
		b := sx - sy - max[i] - min[i]
		d := b * b - 4*((1 - sx) * max[i] - sx * min[i])
		x[i] = (-b + math.Sqrt(d)) / 2
		y[i] = (max[i] - x[i] * sy) / (sx + x[i])
		sx += x[i]
		sy += y[i]
	}
	write(x)
	write(y)
}

func write(s []float64) {
	for i := range s {
		fmt.Fprintf(out, "%.9f", s[i])
		if i + 1 != len(s) {
			out.WriteByte(' ')
		} else {
			out.WriteByte('\n')
		}
	}
}


You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} < p_i > p_{i+1}$$$ (in other words, there are exactly $$$a$$$ local maximums).There are exactly $$$b$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} > p_i < p_{i+1}$$$ (in other words, there are exactly $$$b$$$ local minimums).If such permutations exist, find any such permutation.

The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all test cases doesn't exceed $$$10^5$$$.

For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.

NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 < p_2 > p_3$$$, and $$$2$$$ is the only such index, and $$$p_2> p_3 < p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.

package main

import (
	"bufio"
	"os"
	"fmt"

	"math/rand"
	"time"
)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

const LOCAL = false

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

	if LOCAL {
		n = 1000

		rand.Seed(time.Now().UnixNano())

		for i := 0; i < 1000; i++ {
			a = 1 + rand.Intn(n/2)
			b = 1 + rand.Intn(n/2)

			arr := solve()

			if len(arr) == 1 {
				continue
			}

			lmax := 0
			lmin := 0

			for j := 1; j < n - 1; j++ {
				if arr[j] > arr[j -1] && arr[j] > arr[j + 1] {
					lmax ++
				} else if arr[j] < arr[j - 1] && arr[j] < arr[j + 1] {
					lmin++
				}
			}

			if lmax != a && lmin != b {
				fmt.Println("ERROR")
				fmt.Println(a, b)
				fmt.Println(arr)

				break
			}

		}

		return
	}

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()

		w.Flush()
	}
}

func solve() []int {

	if a == 0 && b == 0 {
		for i := 1; i < n + 1; i++ {
			fmt.Fprint(w, i, " ")
		}
		return []int{-1}
	}

	if a + b > n - 2 {
		fmt.Fprintln(w,-1)
		return []int{-1}
	}

	if abs(a - b) > 1 {
		fmt.Fprintln(w, -1)
		return []int{-1}
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	var cnt = 0

	var arr []int

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		arr = append(arr, curLow)
		curLow++
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			arr = append(arr, curHigh)
			curHigh--
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				arr = append(arr, curHigh)
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				arr = append(arr, curLow)
				curLow++
			}

			cnt++
			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		arr = append(arr, curHigh)
		curHigh--
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			arr = append(arr, curLow)
			curLow++
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				arr = append(arr, curLow)
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				arr = append(arr, curHigh)
				curHigh--
			}

			p++
			cnt++
		}
	}

	fmt.Fprintln(w)

	return arr
}

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

package main

import "fmt"

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func main() {
	var T, n, a, b int
	fmt.Scanln(&T)
	for T > 0 {
		T--
		fmt.Scanf("%d %d %d\n", &n, &a, &b)
		if a+b+2 > n || abs(a-b) > 1 {
			fmt.Println(-1)
			continue
		}
		l, r := 1, n
		t := a > b
		for i := 1; i <= n; i++ {
			if t {
				fmt.Print(l, " ")
				l++
			} else {
				fmt.Print(r, " ")
				r--
			}
			if i <= a+b {
				t = !t
			}
		}
		fmt.Println()
	}
}

package main

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

/*
4
7 2 0
7 2 3
7 3 2
6 2 2
---
-1
2 1 4 3 6 5 7
1 3 2 5 4 7 6
2 1 4 3 6 5
=====
6
5 0 0
5 2 1
5 1 2
5 1 1
5 1 0
5 0 1
---
1 2 3 4 5
1 3 2 5 4
2 1 4 3 5
2 1 3 5 4
1 2 3 5 4
2 1 3 4 5
=======
3
2 0 0
3 1 0
3 0 1
---
1 2
1 3 2
2 1 3
========
4
4 2 0
4 1 0
4 0 1
4 1 1
---
========
6
6 4 0
6 3 1
6 1 3
6 2 0
6 0 2
6 3 3
---
-1
-1
-1
-1
-1
-1
=======
1
6 2 2
---
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	bld := strings.Builder{}

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n, a, b int
		scanf("%d %d %d\n", &n, &a, &b)

		if a+b > n-2 || abs(a-b) > 1 {
			fmt.Fprintln(&bld, -1)
		} else {
			p := make([]int, n)
			for i := 0; i < n; i++ {
				p[i] = i + 1
			}

			if a == 1 && b == 1 {
				p[0], p[1] = p[1], p[0]
				p[n-1], p[n-2] = p[n-2], p[n-1]
			} else if a < b {
				for i := 0; i < b; i++ {
					idx := 2 * i
					p[idx], p[idx+1] = p[idx+1], p[idx]
				}
			} else {
				for i := n - 1; i > n-2*a; i -= 2 {
					p[i], p[i-1] = p[i-1], p[i]
				}
				if a != 0 && a == b {
					p[0], p[1] = p[1], p[0]
				}
			}

			for _, num := range p {
				fmt.Fprintf(&bld, "%d ", num)
			}
			fmt.Fprintln(&bld)
		}
	}

	printf("%s", bld.String())
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

//goland:noinspection GoUnusedType
type pair struct {
	fst int
	snd int
}

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

//goland:noinspection GoUnusedFunction
func printf(f string, a ...interface{}) {
	if _, err := fmt.Fprintf(writer, f, a...); err != nil {
		panic(err)
	}
}

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

func case1(a, b int, n int, out io.Writer) {
	Fprintf(out, "%d ", 1)
	le, ri := 2, n
	turn := true
	for {
		if turn {
			if a == 0 {
				for i := le; i <= ri; i++ {
					Fprintf(out, "%d ", i)
				}
				Fprintln(out)
				return
			}
			Fprintf(out, "%d ", ri)
			ri--
			a--
			// if a == 0 {
			//     for i := ri; i >= le; i-- {
			//         Fprintf(out, "%d ", i)
			//     }
			//     Fprintln(out)
			//     return
			// }
		} else {
			if b == 0 {
				for i := ri; i >= le; i-- {
					Fprintf(out, "%d ", i)
				}
				Fprintln(out)
				return
			}
			Fprintf(out, "%d ", le)
			le++
			b--
		}
		turn = !turn
	}
}
func case2(a, b, n int, out io.Writer) {
	Fprintf(out, "%d ", n)
	le, ri := 1, n-1
	turn := false
	for {
		if turn {
			if a == 0 {
				for i := le; i <= ri; i++ {
					Fprintf(out, "%d ", i)
				}
				Fprintln(out)
				return
			}
			Fprintf(out, "%d ", ri)
			ri--
			a--
		} else {
			if b == 0 {
				for i := ri; i >= le; i-- {
					Fprintf(out, "%d ", i)
				}
				Fprintln(out)
				return
			}
			Fprintf(out, "%d ", le)
			le++
			b--
		}
		turn = !turn
	}
}
func CF1608B(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var t int
	var n, a, b int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &a, &b)
		if a > b+1 || b > a+1 || a+b > n-2 {
			Fprintln(out, -1)
			continue
		}
		if a >= b {
			case1(a, b, n, out)
		} else {
			case2(a, b, n, out)
		}
	}
}

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

package main

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

func abs(n int) int {
	if n < 0 {
		return n * -1
	}
	return n
}

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

	var T int
	fmt.Fscan(in, &T)

	for t := 0; t < T; t++ {
		var n, a, b int
		fmt.Fscan(in, &n, &a, &b)

		if abs(a-b) > 1 || a+b > n-2 {
			fmt.Fprintln(out, -1)
		} else {
			arr := make([]int, n)
			for i := 0; i < n; i++ {
				arr[i] = i + 1
			}

			if a > b {
				arr[n-1], arr[n-2] = arr[n-2], arr[n-1]
				a--
			}

			if b > a {
				arr[0], arr[1] = arr[1], arr[0]
				b--
			}

			for i := 2; i < n; i++ {
				if a == 0 {
					break
				}

				if a > 0 && arr[i]-arr[i-1] == 1 {
					arr[i], arr[i-1] = arr[i-1], arr[i]
					a--
					b--
				}

			}

			for _, v := range arr {
				fmt.Fprintf(out, "%d ", v)
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

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

	var T, n, u, d int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &u, &d)
		if u-d > 1 || d-u > 1 || u+d > n-2 {
			Fprintln(out, -1)
			continue
		}
		if u > d {
			v, w := 1, n
			i := 0
			for ; i < n; i++ {
				if i&1 == 0 {
					Fprint(out, v, " ")
					v++
				} else {
					Fprint(out, w, " ")
					w--
					if u--; u == 0 {
						break
					}
				}
			}
			for i++; i < n; i++ {
				Fprint(out, w, " ")
				w--
			}
		} else if u == d {
			v, w := 1, n
			i := 0
			for ; i < n; i++ {
				if i&1 == 0 {
					Fprint(out, v, " ")
					v++
					if d--; d == -1 {
						break
					}
				} else {
					Fprint(out, w, " ")
					w--
				}
			}
			for i++; i < n; i++ {
				Fprint(out, v, " ")
				v++
			}
		} else {
			v, w := 1, n
			i := 0
			for ; i < n; i++ {
				if i&1 == 1 {
					Fprint(out, v, " ")
					v++
					if d--; d == 0 {
						break
					}
				} else {
					Fprint(out, w, " ")
					w--
				}
			}
			for i++; i < n; i++ {
				Fprint(out, v, " ")
				v++
			}
		}
		Fprintln(out)
	}
}

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

package main

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

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

func (in *CF1608B) 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 *CF1608B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1608B
Date: 11/12/21
User: epradere
URL: https://codeforces.com/contest/1608/problem/B
Problem: CF1608B
**/
func (in *CF1608B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n, a, b := in.NextInt(), in.NextInt(), in.NextInt()
		diff := int(math.Abs(float64(a - b)))
		if diff >= 2 || a+b >= n {
			fmt.Println(-1)
		} else {
			arr := make([]int, n)
			if a > b {
				i, j, p := 0, 1, n
				for ; i < a+b && i < n; i++ {
					if i%2 == 0 {
						arr[i] = j
						j++
					} else {
						arr[i] = p
						p--
					}
				}
				for ; i < n; i++ {
					arr[i] = p
					p--
				}
			} else if a < b {
				i, j, p := 0, 1, n
				for ; i <= a+b && i < n; i++ {
					if i%2 != 0 {
						arr[i] = j
						j++
					} else {
						arr[i] = p
						p--
					}
				}
				for ; i < n; i++ {
					arr[i] = j
					j++
				}
			} else {
				i, j, p := 0, 1, n
				for ; i <= a+b && i < n; i++ {
					if i%2 != 0 {
						arr[i] = j
						j++
					} else {
						arr[i] = p
						p--
					}
				}
				for ; i < n; i++ {
					arr[i] = p
					p--
				}
			}

			max, min := 0, 0
			for i := 1; i < n-1; i++ {
				if arr[i-1] < arr[i] && arr[i+1] < arr[i] {
					max++
				} else if arr[i-1] > arr[i] && arr[i+1] > arr[i] {
					min++
				}
			}
			if max == a && min == b {
				for i := 0; i < n; i++ {
					fmt.Print(arr[i], " ")
				}
				fmt.Println()
			} else {
				fmt.Println(-1)
			}

		}

	}
}

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

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

package main

import (
	"bufio"
	"os"
	"fmt"

	"math/rand"
	"time"
)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

const LOCAL = false

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

	if LOCAL {
		n = 1000

		rand.Seed(time.Now().UnixNano())

		for i := 0; i < 1000; i++ {
			a = 1 + rand.Intn(n/2)
			b = 1 + rand.Intn(n/2)

			arr := solve()

			if len(arr) == 1 {
				continue
			}

			lmax := 0
			lmin := 0

			for j := 1; j < n - 1; j++ {
				if arr[j] > arr[j -1] && arr[j] > arr[j + 1] {
					lmax ++
				} else if arr[j] < arr[j - 1] && arr[j] < arr[j + 1] {
					lmin++
				}
			}

			if lmax != a && lmin != b {
				fmt.Println("ERROR")
				fmt.Println(a, b)
				fmt.Println(arr)

				break
			}

		}

		return
	}

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()

		w.Flush()
	}
}

func solve() []int {

	if a == 0 && b == 0 {
		for i := 1; i < n + 1; i++ {
			fmt.Fprint(w, i, " ")

			return []int{-1}
		}
	}

	if a + b > n - 2 {
		fmt.Fprintln(w,-1)
		return []int{-1}
	}

	if abs(a - b) > 1 {
		fmt.Fprintln(w, -1)
		return []int{-1}
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	var cnt = 0

	var arr []int

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		arr = append(arr, curLow)
		curLow++
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			arr = append(arr, curHigh)
			curHigh--
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				arr = append(arr, curHigh)
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				arr = append(arr, curLow)
				curLow++
			}

			cnt++
			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		arr = append(arr, curHigh)
		curHigh--
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			arr = append(arr, curLow)
			curLow++
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				arr = append(arr, curLow)
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				arr = append(arr, curHigh)
				curHigh--
			}

			p++
			cnt++
		}
	}

	fmt.Fprintln(w)

	return arr
}

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

package main

import (
	"bufio"
	"os"
	"fmt"

	"math/rand"
	"time"
)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

const LOCAL = false

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

	if LOCAL {
		n = 1000

		rand.Seed(time.Now().UnixNano())

		for i := 0; i < 1000; i++ {
			a = 1 + rand.Intn(n/2)
			b = 1 + rand.Intn(n/2)

			arr := solve()

			if len(arr) == 1 {
				continue
			}

			lmax := 0
			lmin := 0

			for j := 1; j < n - 1; j++ {
				if arr[j] > arr[j -1] && arr[j] > arr[j + 1] {
					lmax ++
				} else if arr[j] < arr[j - 1] && arr[j] < arr[j + 1] {
					lmin++
				}
			}

			if lmax != a && lmin != b {
				fmt.Println("ERROR")
				fmt.Println(a, b)
				fmt.Println(arr)

				break
			}

		}

		return
	}

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()

		w.Flush()
	}
}

func solve() []int {
	if a + b > n - 2 {
		fmt.Fprintln(w,-1)
		return []int{-1}
	}

	if abs(a - b) > 1 {
		fmt.Fprintln(w, -1)
		return []int{-1}
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	var cnt = 0

	var arr []int

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		arr = append(arr, curLow)
		curLow++
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			arr = append(arr, curHigh)
			curHigh--
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				arr = append(arr, curHigh)
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				arr = append(arr, curLow)
				curLow++
			}

			cnt++
			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		arr = append(arr, curHigh)
		curHigh--
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			arr = append(arr, curLow)
			curLow++
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				arr = append(arr, curLow)
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				arr = append(arr, curHigh)
				curHigh--
			}

			p++
			cnt++
		}
	}

	fmt.Fprintln(w)

	return arr
}

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

package main

import (
	"bufio"
	"os"
	"fmt"

)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()
	}
}

func solve()  {
	if a + b > n - 2 {
		fmt.Println(-1)
		return
	}

	if abs(a - b) > 1 {
		fmt.Println(-1)
		return
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	var cnt = 0

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		curLow++
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			curHigh--
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				curLow++
			}

			cnt++
			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		curHigh--
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			curLow++
			cnt++
		}

		var p int = 1

		for ; cnt < n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			}

			p++
			cnt++
		}
	}

	fmt.Fprintln(w)
	w.Flush()
}

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

package main

import (
	"bufio"
	"os"
	"fmt"

)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()
	}
}

func solve()  {
	if a + b > n - 2 {
		fmt.Println(-1)
		return
	}

	if abs(a - b) > 1 {
		fmt.Println(-1)
		return
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	var cnt = 0

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		curLow++
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			curHigh--
			cnt++
		}

		var p int = 1

		for ; cnt <= n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				curLow++
			}

			cnt++
			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		curHigh--
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			curLow++
			cnt++
		}

		var p int = 1

		for ;cnt <= n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			}

			p++
			cnt++
		}
	}

	w.Flush()
}

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

package main

import (
	"bufio"
	"os"
	"fmt"

)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()
	}
}

func solve()  {
	if a + b > n - 2 {
		fmt.Println(-1)
		return
	}

	if abs(a - b) > 1 {
		fmt.Println(-1)
		return
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	var cnt = 0

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		curLow++
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			curHigh--
			cnt++
		}

		var p int = 1

		for ;curLow <= curHigh && cnt <= n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				curLow++
			}

			cnt++
			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		curHigh--
		cnt++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			curLow++
			cnt++
		}

		var p int = 1

		for ;curLow <= curHigh && cnt <= n; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			}

			p++
			cnt++
		}
	}

	w.Flush()
}

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

package main

import (
	"bufio"
	"os"
	"fmt"

)

const MOD int64 = 1000000007

var n, a, b int

var r *bufio.Reader
var w *bufio.Writer

func main() {

	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)

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

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n, &a, &b)

		solve()
	}
}

func solve()  {
	if a + b > n - 2 {
		fmt.Println(-1)
		return
	}

	if abs(a - b) > 1 {
		fmt.Println(-1)
		return
	}

	var maxA int
	var maxB int

	if n % 2 == 0 {
		maxA = (n - 2)/2
		maxB = (n - 2)/2
	} else {
		maxA = (n - 2)/2  + 1
		maxB = (n - 2)/2
	}

	s := maxA + maxB

	curLow := 1
	curHigh := n

	if a >= b {
		fmt.Fprint(w, curLow, " ")
		curLow++

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curHigh, " ")
			curHigh--
		}

		fmt.Fprint(w, curLow, " ")
		curLow++

		var p int

		for ;curLow <= curHigh; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			} else {
				fmt.Fprint(w, curLow, " ")
				curLow++
			}

			p++
		}

	} else {
		fmt.Fprint(w, curHigh, " ")
		curHigh--

		for j := 0; j < s - (a + b) + 1; j++ {
			fmt.Fprint(w, curLow, " ")
			curLow++
		}

		fmt.Fprint(w, curHigh, " ")
		curHigh--

		var p int

		for ;curLow <= curHigh; {
			iter := p % 2

			if iter == 0 {
				fmt.Fprint(w, curLow, " ")
				curLow++
			} else {
				fmt.Fprint(w, curHigh, " ")
				curHigh--
			}

			p++
		}
	}

	w.Flush()
}

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

package main

import "fmt"

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func main() {
	var T, n, a, b int
	fmt.Scanln(&T)
	for T > 0 {
		T--
		fmt.Scanf("%d %d %d", &n, &a, &b)
		if a+b+2 > n || abs(a-b) > 1 {
			fmt.Println(-1)
			continue
		}
		l, r := 1, n
		t := a > b
		for i := 1; i <= n; i++ {
			if t {
				fmt.Print(l, " ")
				l++
			} else {
				fmt.Print(r, " ")
				r--
			}
			if i <= a+b {
				t = !t
			}
		}
	}
}

package main

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

/*
4
7 2 0
7 2 3
7 3 2
6 2 2
---
-1
2 1 4 3 6 5 7
1 3 2 5 4 7 6
2 1 4 3 6 5
=====
4
5 0 0
5 2 1
5 1 2
5 1 1
---
1 2 3 4 5
1 3 2 5 4
2 1 4 3 5
2 1 3 5 4
=======
3
2 0 0
3 1 0
3 0 1
---
1 2
1 3 2
2 1 3
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	bld := strings.Builder{}

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n, a, b int
		scanf("%d %d %d\n", &n, &a, &b)

		if a+b > n-2 || abs(a-b) > 1 {
			fmt.Fprintln(&bld, -1)
		} else {
			p := make([]int, n)
			for i := 0; i < n; i++ {
				p[i] = i + 1
			}

			if a == 1 && b == 1 {
				p[0], p[1] = p[1], p[0]
				p[n-1], p[n-2] = p[n-2], p[n-1]
			} else if a < b {
				for i := 0; i < b; i++ {
					idx := 2 * i
					p[idx], p[idx+1] = p[idx+1], p[idx]
				}
			} else {
				for i := n - 1; i > n-2*a; i -= 2 {
					p[i], p[i-1] = p[i-1], p[i]
				}
			}

			for _, num := range p {
				fmt.Fprintf(&bld, "%d ", num)
			}
			fmt.Fprintln(&bld)
		}
	}

	printf("%s", bld.String())
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

//goland:noinspection GoUnusedType
type pair struct {
	fst int
	snd int
}

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

//goland:noinspection GoUnusedFunction
func printf(f string, a ...interface{}) {
	if _, err := fmt.Fprintf(writer, f, a...); err != nil {
		panic(err)
	}
}

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}