package main import ( "sort" "bufio" "fmt" "os" "strconv" ) var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout) func scanString() string { sc.Scan(); return sc.Text() } func scanInt() int { a,_ := strconv.Atoi(scanString()); return a } func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a } func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a } func scanInts(n int) []int { res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res } func abs(a int) int { if a<0 { return -a }; return a } func min(a,b int) int { if ab { return a }; return b } //•*¨*•.¸¸♪Main•*¨*•.¸¸♪( -ω-)ノ ( ・ω・) func main() { sc.Split(bufio.ScanWords) sc.Buffer(make([]byte, 10000), 1000000) n := scanInt() m := scanInt() k := scanInt() op := scanString() ans := 0 b := scanInts(m) a := scanInts(n) sort.Ints(a) sort.Ints(b) // fmt.Println(b) for i := 0; i < n; i++ { var f func(j int) bool if op == "+" { f = func(j int) bool { return k <= b[j]+a[i] } } else { f = func(j int) bool { return k <= b[j]*a[i] } } index := sort.Search(len(b),f) ans += m - index // fmt.Println(a[i],index) } fmt.Println(ans) }