// https://yukicoder.me/problems/no/2947 fun main() { val n = readln().toInt() var (s, t) = readln().split(" ") val a = readln().split(" ").map { it.toInt() } if(s.length < t.length) { val u = s s = t t = u } for(w in a) { // a|s| + b|t| = w for(i in 0..(w/s.length)){ if((w - i*s.length) % t.length == 0) { val j = (w - i*s.length) / t.length for(k in 0..