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FyYW0gblNyY0xlbmd0aCDUtNfWt/u0rrOktsgNCisgKiBAcmV0dXJuIMS/serK/b7ds6S2yA0KKyAqIEBub3RlICAgDQorICogQHdhcm5pbmcgDQorICovDQoraW50IHN0cmluZzJieXRlcyhjb25zdCBjaGFyKiBwU3JjLCB1bnNpZ25lZCBjaGFyKiBwRHN0LCBpbnQgblNyY0xlbmd0aCkNCit7DQorICAgIGludCBpPTA7DQorDQorICAgIC8v0KPR6bLOyv0NCisgICAgaWYocFNyYyA9PSAgTlVMTCB8fCBwRHN0ID09IE5VTEwgfHwgblNyY0xlbmd0aCA8IDApDQorICAgIHsNCisgICAgICAgIHJldHVybiAtMTsNCisgICAgfQ0KKw0KKyAgICBmb3IoaSA9IDA7IGkgPCBuU3JjTGVuZ3RoOyBpICs9IDIpDQorICAgIHsNCisgICAgICAgIC8vIMrks/a43zTOuw0KKyAgICAgICAgaWYoKnBTcmMgPj0gJzAnICYmICpwU3JjIDw9ICc5JykNCisgICAgICAgIHsNCisgICAgICAgICAgICAqcERzdCA9ICgqcFNyYyAtICcwJykgPDwgNDsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UNCisgICAgICAgIHsNCisgICAgICAgICAgICAqcERzdCA9ICgodG91cHBlcigqcFNyYykgLSAnQScpICsgMTApIDw8IDQ7DQorICAgICAgICB9DQorDQorICAgICAgICBwU3JjKys7DQorDQorICAgICAgICAvLyDK5LP2tc00zrsNCisgICAgICAgIGlmKCpwU3JjID49ICcwJyAmJiAqcFNyYyA8PSAnOScpDQorICAgICAgICB7DQorICAgICAgICAgICAgKnBEc3QgfD0gKnBTcmMgLSAnMCc7DQorICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7DQorICAgICAgICAgICAgKnBEc3QgfD0gKHRvdXBwZXIoKnBTcmMpIC0gJ0EnKSArIDEwOw0KKyAgICAgICAgfQ0KKw0KKyAgICAgICAgcFNyYysrOw0KKyAgICAgICAgcERzdCsrOw0KKyAgICB9DQorDQorICAgIC8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NoYXIgYmFzZVtdID0gIkFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky89IjsgDQorDQorCWlmKGRhdGEgPT0gTlVMTCkNCisJew0KKwkJcmV0dXJuIE5VTEw7DQorCX0NCisJaWYoZGF0YV9sZW4gPT0gMCkNCisJew0KKwkJcmV0dXJuIE5VTEw7DQorCX0NCisgICAgcmV0X2xlbiA9IGRhdGFfbGVuIC8gMzsgDQorICAgIHRlbXAgPSBkYXRhX2xlbiAlIDM7IA0KKyAgICBpZiAodGVtcCA+IDApIA0KKyAgICB7IA0KKyAgICAgICAgcmV0X2xlbiArPSAxOyANCisgICAgfSANCisgICAgcmV0X2xlbiA9IHJldF9sZW4qNCArIDE7IA0KKyAgICByZXQgPSAoY2hhciAqKW1hbGxvYyhyZXRfbGVuKTsgDQorICAgICAgDQorICAgIGlmIChyZXQgPT0gTlVMTCkgDQorICAgIHsgDQorICAgICAgICBwcmludGYoIk5vIGVub3VnaCBtZW1vcnkuXG4iKTsgDQorICAgICAgICByZXR1cm4gTlVMTDsNCisgICAgfSANCisgICAgbWVtc2V0KHJldCwgMCwgcmV0X2xlbik7IA0KKyAgICBmID0gcmV0OyANCisgICAgd2hpbGUgKHRtcCA8IGRhdGFfbGVuKSANCisgICAgeyANCisgICAgICAgIHRlbXAgPSAwOyANCisgICAgICAgIHByZXBhcmUgPSAwOyANCisgICAgICAgIG1lbXNldChjaGFuZ2VkLCAnXDAnLCA0KTsgDQorICAgICAgICB3aGlsZSAodGVtcCA8IDMpIA0KKyAgICAgICAgeyANCisgICAgICAgICAgICAvL3ByaW50ZigidG1wID0gJWRcbiIsIHRtcCk7IA0KKyAgICAgICAgICAgIGlmICh0bXAgPj0gZGF0YV9sZW4pIA0KKyAgICAgICAgICAgIHsgDQorICAgICAgICAgICAgICAgIGJyZWFrOyANCisgICAgICAgICAgICB9IA0KKyAgICAgICAgICAgIHByZXBhcmUgPSAoKHByZXBhcmUgPDwgOCkgfCAoZGF0YVt0bXBdICYgMHhGRikpOyANCisgICAgICAgICAgICB0bXArKzsgDQorICAgICAgICAgICAgdGVtcCsrOyANCisgICAgICAgIH0gDQorICAgICAgICBwcmVwYXJlID0gKHByZXBhcmU8PCgoMy10ZW1wKSo4KSk7IA0KKyAgICAgICAgLy9wcmludGYoImJlZm9yZSBmb3IgOiB0ZW1wID0gJWQsIHByZXBhcmUgPSAlZFxuIiwgdGVtcCwgcHJlcGFyZSk7IA0KKyAgICAgICAgZm9yIChpID0gMDsgaSA8IDQgO2krKyApIA0KKyAgICAgICAgeyANCisgICAgICAgICAgICBpZiAodGVtcCA8IGkpIA0KKyAgICAgICAgICAgIHsgDQorICAgICAgICAgICAgICAgIGNoYW5nZWRbaV0gPSAweDQwOyANCisgICAgICAgICAgICB9IA0KKyAgICAgICAgICAgIGVsc2UgDQorICAgICAgICAgICAgeyANCisgICAgICAgICAgICAgICAgY2hhbmdlZFtpXSA9IChwcmVwYXJlPj4oKDMtaSkqNikpICYgMHgzRjsgDQorICAgICAgICAgICAgfSANCisgICAgICAgICAgICAqZiA9IGJhc2VbY2hhbmdlZFtpXV07IA0KKyAgICAgICAgICAgIC8vcHJpbnRmKCIlLjJYIiwgY2hhbmdlZFtpXSk7IA0KKyAgICAgICAgICAgIGYrKzsgDQorICAgICAgICB9IA0KKyAgICB9IA0KKyAgICAqZiA9ICdcMCc7IA0KKyAgICByZXR1cm4gcmV0OyANCit9IA0KKw0KK3Vuc2lnbmVkIGNoYXIgKmxwYV9iYXNlNjRfZGVjb2RlKGNvbnN0IHVuc2lnbmVkIGNoYXIgKnNyYywgaW50IGxlbiwgaW50ICpvdXRfbGVuKQ0KK3sNCisJdW5zaWduZWQgY2hhciBkdGFibGVbMjU2XSA9IHswfTsvL2t3DQorCXVuc2lnbmVkIGNoYXIgKm91dCA9IE5VTEw7DQorCXVuc2lnbmVkIGNoYXIgKnBvcyA9IE5VTEw7DQorCXVu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