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KKwlpbnQgaSwgZXJyID0gMDsKKworCXByaW50ZigiTUFDIEFkZHJlc3M6ICIpOworCWVyciA9IGkgPSAwOworCWZvciAoaSA9IDA7IGkgPCAzOyBpKyspIHsKKwkJcmVnID0gcmVhZF9lZXByb21fcmVnKDB4MjAgKyBpKTsKKwkJcHJpbnRmKCIlMDJ4OiUwMnglYyIsIHJlZyAmIDB4ZmYsIHJlZyA+PiA4LCBpICE9IDIgPyAnOicgOiAnXG4nKTsKKwkJaWYgKHMpCisJCQllcnIgfD0gcmVnICE9ICgodTE2ICopcylbaV07CisJfQorCisJcmV0dXJuIGVyciA/IDAgOiAxOworfQorCitzdGF0aWMgaW50IHNldF9tYWMoY2hhciAqcykKK3sKKwlpbnQgaTsKKwljaGFyICplLCBlYWRkcls2XTsKKworCS8qIHR1cm4gc3RyaW5nIGludG8gbWFjIHZhbHVlICovCisJZm9yIChpID0gMDsgaSA8IDY7IGkrKykgeworCQllYWRkcltpXSA9IHNpbXBsZV9zdHJ0b3VsKHMsICZlLCAxNik7CisJCXMgPSAoKmUpID8gZSsxIDogZTsKKwl9CisKKwlmb3IgKGkgPSAwOyBpIDwgMzsgaSsrKQorCQl3cml0ZV9lZXByb21fcmVnKCooKCh1MTYgKillYWRkcikgKyBpKSwgMHgyMCArIGkpOworCisJcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBpbnQgcGFyc2VfZWxlbWVudChjaGFyICpzLCB1bnNpZ25lZCBjaGFyICpidWYsIGludCBsZW4pCit7CisJaW50IGNudDsKKwljaGFyICpwLCBudW1bM107CisJdW5zaWduZWQgY2hhciBpZDsKKworCWlkID0gc2ltcGxlX3N0cnRvdWwocywgJnAsIDE2KTsKKwlpZiAoKnArKyAhPSAnOicpCisJCXJldHVybiAtMTsKKwljbnQgPSAyOworCW51bVsyXSA9IDA7CisJZm9yICg7ICpwOyBwICs9IDIpIHsKKwkJaWYgKHBbMV0gPT0gMCkKKwkJCXJldHVybiAtMjsKKwkJaWYgKGNudCArIDMgP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