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oJCXJldHVybiBXSUZJX0xBTl9ERVY7CgoJcmV0dXJuIC0xOwp9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKiC6r8r9w/uzxqO6IHNldF9wc3dhbnN0YXRlCioguabE3MPoyvajuiDJ6NbDcHPN+MLnyeixuElQdjbXtMysTlbWtQoqILLOyv3LtcP3o7ogY19pZChJTikgOlBEULyku+61xGNfaWQKKiAgICAgICAgICAgIHN0YXRlKElOKTrN+MLnyeixuNe0zKwKKiC3tSC72CDWtaO6CiogxuTL/Mu1w/ejugoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KCnN0YXRpYyB2b2lkIHNldF9wc3dhbl92NnN0YXRlKGludCBjX2lkLCBpbnQgc3RhdGUpCnsKCWNoYXIgcHNfd2FuW05WX05BTUVfTEVOXSA9IHswfTsKCWNoYXIgcHN3YW5fc3RhdGVbTkVUSUZfTkFNRV9MRU5dID0gezB9OwoKCWNmZ19nZXRfaXRlbSgicHN3YW4iLCBwc193YW4sIHNpemVvZihwc193YW4pKTsKCglzbnByaW50Zihwc3dhbl9zdGF0ZSwgc2l6ZW9mKHBzd2FuX3N0YXRlKSwgIiVzJWRfaXB2Nl9zdGF0ZSIsIHBzX3dhbiwgY19pZCk7CgoJaWYgKHN0YXRlID09IERFVl9TVEFURV9XT1JLSU5HKSB7CgkJY2ZnX3NldChwc3dhbl9zdGF0ZSwgIndvcmtpbmciKTsKCQlyZXR1cm47Cgl9CgoJaWYgKHN0YXRlID09IERFVl9TVEFURV9DT05ORUNUKSB7CgkJY2ZnX3NldChwc3dhbl9zdGF0ZSwgImNvbm5lY3QiKTsKCQlyZXR1cm47Cgl9CglpZiAoc3RhdGUgPT0gREVWX1NUQVRFX0RFQUQpIHsKCQljZmdfc2V0KHBzd2FuX3N0YXRlLCAiZGVhZCIpOw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c/N4s34uvPU2bX308OjrLfx1PLO3reou/HIoc3izfi/2r340NDB97/YCiogICAgICAgICAgICAgICAgINX9s6O52Lv61tjQwr+qu/qjrNaux7DJ6NbDtcTB97/Y0sDIu9PQ0KcKKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmludCB0Y19jb250cm9sKHN0cnVjdCB0Y19jb250cm9sX2luZm8gKnRjaW5mbywgaW50IHNyY19pZCkKewoJaW50IHJldCA9IDA7CgoJcHJpbnRmKCJuZXRhcGk6dGNfY29udHJvbCBzdGFydCEgY19pZDolZCwgZG93bjoldSwgdXA6JXVcbiwgc3JjOiVkIFxuIiwgdGNpbmZvLT5jX2lkLCB0Y2luZm8tPnRjX2Rvd25saW5rLCB0Y2luZm8tPnRjX3VwbGluaywgc3JjX2lkKTsKCglyZXQgPSBpcGNfc2VuZF9tZXNzYWdlKHNyY19pZCwgTU9EVUxFX0lEX01BSU5fQ1RSTCwgTVNHX0NNRF9ORVRfVENfQ1RSTCwgc2l6ZW9mKHN0cnVjdCB0Y19jb250cm9sX2luZm8pLCAoVUNIQVIgKil0Y2luZm8sIDApOwoJaWYgKDAgIT0gcmV0KSB7CgkJc29mdGFwX2Fzc2VydCgic2VuZCBtc2cgdG8genRlX3JvdXRlciBlcnJvciIpOwoJCXJldHVybiAwOwoJfQoJcmV0dXJuIDE7Cn0KCiNkZWZpbmUgU0lPQ0RFVlBSSVZBVEUgMFg4OUYwCiNkZWZpbmUgU0lPQ1ZMQU4JCVNJT0NERVZQUklWQVRFKzB4MAkKCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqILqvyv3D+7PGo7ogc2V0X2V0aHdhbl9tb2RlCioguabE3MPoyvajuiDJ6NbDc3dpdGNoyeixuGV0aDAuMjAwzfi/2rbU06a1xHBvcnQzzqp3YW6/2ru5ysd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