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oJCXJldHVybiBXSUZJX0xBTl9ERVY7CgoJcmV0dXJuIC0xOwp9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiC6r8r9w/uzxqO6IHNldF9wc3dhbnN0YXRlCioguabE3MPoyvajuiDJ6NbDcHPN+MLnyeixuElQdjbXtMysTlbWtQoqILLOyv3LtcP3o7ogY19pZChJTikgOlBEULyku+61xGNfaWQKKiAgICAgICAgICAgIHN0YXRlKElOKTrN+MLnyeixuNe0zKwKKiC3tSC72CDWtaO6CiogxuTL/Mu1w/ejugoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KCnN0YXRpYyB2b2lkIHNldF9wc3dhbl92NnN0YXRlKGludCBjX2lkLCBpbnQgc3RhdGUpCnsKCWNoYXIgcHNfd2FuW05WX05BTUVfTEVOXSA9IHswfTsKCWNoYXIgcHN3YW5fc3RhdGVbTkVUSUZfTkFNRV9MRU5dID0gezB9OwoKCWNmZ19nZXRfaXRlbSgicHN3YW4iLCBwc193YW4sIHNpemVvZihwc193YW4pKTsKCglzbnByaW50Zihwc3dhbl9zdGF0ZSwgc2l6ZW9mKHBzd2FuX3N0YXRlKSwgIiVzJWRfaXB2Nl9zdGF0ZSIsIHBzX3dhbiwgY19pZCk7CgoJaWYgKHN0YXRlID09IERFVl9TVEFURV9XT1JLSU5HKSB7CgkJY2ZnX3NldChwc3dhbl9zdGF0ZSwgIndvcmtpbmciKTsKCQlyZXR1cm47Cgl9CgoJaWYgKHN0YXRlID09IERFVl9TVEFURV9DT05ORUNUKSB7CgkJY2ZnX3NldChwc3dhbl9zdGF0ZSwgImNvbm5lY3QiKTsKCQlyZXR1cm47Cgl9CglpZiAoc3RhdGUgPT0gREVWX1NUQVRFX0RFQUQpIHsKCQljZmdfc2V0KHBzd2FuX3N0YXRlLCAiZGVhZCIpOw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c2VydCgic2VuZCBtc2cgdG8genRlX3JvdXRlciBlcnJvciIpOwoJCXJldHVybiAwOwoJfQojaWZkZWYgX1VTRV9NQklNCQoJc2xvZyhORVRfUFJJTlQsIFNMT0dfRVJSLCAibmV0YXBpOm5ldGRldl9wbHVnaW5fcHJvYzogc2VuZCBNU0dfQ01EX05FVF9QTFVHSU4gdG8gTUJJTVxuIik7CglpcGNfc2VuZF9tZXNzYWdlMihzcmNfaWQsIE1PRFVMRV9JRF9NQklNLCBNU0dfQ01EX05FVF9QTFVHSU4sIHNpemVvZih1bnNpZ25lZCBjaGFyKSwgKFVDSEFSICopJm5ldGRldl9pZCwgMCk7IAojZW5kaWYKCXJldHVybiAxOwp9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiC6r8r9w/uzxqO6IG5ldGRldl9wbHVnb3V0X3Byb2MKKiC5psTcw+jK9qO6IMjIsuWwzsnosbiwzrP2LL3Tv9rE2rK/vfjQ0GlmY29uZmlnIGRvd26jrLKiybG19M/g06a1xLXY1re31sXkvfizzAoqILLOyv3LtcP3o7ogbmV0ZGV2X2lko7rN+MLnyeixuLbU06a1xLrqw/ujrLLOvPtVU0JfTkVUX0RFVrXIuurWtQoqILe1ILvYINa1o7ogstnX97PJuaa3tbvYMS4KKiDG5Mv8y7XD96O6IMnosbjW97/YtffTw7TLvdO/2sqxo6yx7cP3uMPN+MLnyeixuM7vwO3NqMK30tG2z6OssrvSqtTZvfjQ0ElQyv2+3bD8ytW3ogoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KaW50IG5ldGRldl9wbHVnb3V0X3Byb2ModW5zaWduZWQgY2hhciBuZXRkZXZfaWQsIGludCBzcmNfaWQpCnsKCWludCByZXQgPSAwOwoKCXByaW50ZigibmV0YXBpOm5ldGRldl9wbHVnb3V0X3Byb2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WuLSz9rOnyejWw8qxvatNQUMtSVCw87aouebU8sflv9UKCWNmZ19nZXRfaXRlbSgicGF0aF9zaCIsIHBhdGhfc2NyaXB0LCBzaXplb2YocGF0aF9zY3JpcHQpKTsKCW1lbXNldChjbWQsIDAsIHNpemVvZihjbWQpKTsKCXNwcmludGYoY21kLCAiJXMvY29uZmlnLXVkaGNwZC5zaCBcImxhblwiIC1TIiwgcGF0aF9zY3JpcHQpOwoJc29mdF9zeXN0ZW0oY21kKTsKfQoKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCioguq/K/cP7s8ajuiB0Y19jb250cm9sCioguabE3MPoyvajuiDB98G/v9jWxgoqILLOyv3LtcP3o7og0OjSqsH3wb+84L/YtcTJz8/C0NDBv6Osyv2+3b+o0OjSqtPQY2lko6x1ZmnEo8q9srvQ6NKqCiogICAgICAgICAgICAwse3KvrK70OjSqsH3v9ijrLWlzrs6Yml0o6zS8mxpbnV4serXvMP8we7Kx7bU19a92rSmwO2jrMv50tTX7tbVxeTWw9a1u+HV+7P9OAoqILe1ILvYINa1o7ogstnX97PJuaa3tbvYMS4KKiDG5Mv8y7XD96O6ILj40OjSqsH3wb+/2NbGtcTTptPDtffTw6OsyOfJz9DQ0OjSqsH3v9ijrMfrtcjE3MnPzeLN+Lrz1Nm199PDo6y38dTyzt63qLvxyKHN4s34v9q9+NDQwfe/2AoqICAgICAgICAgICAgICAgICDV/bOjudi7+tbY0MK/qrv6o6zWrsewyejWw7XEwfe/2NLAyLvT0NCnCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwppbnQgdGNfY29udHJvbChzdHJ1Y3QgdGNfY29udHJvbF9pbmZvICp0Y2luZm8sIGludCBzcmNfaWQpCnsKCWludCByZXQgPSAwOwoKCXByaW50ZigibmV0YXBpOnRjX2NvbnRyb2wgc3R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