package main

import . "fmt"

func main() {
	var t int
	Scan(&t)
	for ; t > 0 ; t-- {
		var s string
		Scan(&s)
		b := []byte(s)
		minus := false
		mustnum := true
		for i, ch := range b {
			if ch != '?' {
				switch {
					case ch == '-':
						minus = true
						mustnum = true
					case ch == '+':
						minus = false
						mustnum = true
					case minus:
						mustnum = false
				}
				continue
			}
			switch {
				case minus && mustnum:
					b[i] = '1'
					mustnum = false
				case minus && !mustnum:
					if i+1<len(b)&&(b[i+1]!='-'&&b[i+1]!='+') {
						b[i] = '+'
						minus = false
						mustnum = true
					} else {
						b[i] = '1'
					}
				case !minus && mustnum:
					b[i] = '9'
				case !minus && !mustnum:
					panic("bug?")
			}
		}
		Println(string(b))
	}
}