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IC8vUE5QRW52X1RVTkVSX0ZNMTIzNjoKICAgICAgICAgICAgICAgIGNhc2UgMzg6IC8vUE5QRW52X1RVTkVSX0ZNUjEyMzY6CiAgICAgICAgICAgICAgICBjYXNlIDE2OiAvL1BOUEVudl9UVU5FUl9GUjEyMTZfTUsyOgogICAgICAgICAgICAgICAgY2FzZSAxOTogLy9QTlBFbnZfVFVORVJfRlIxMjQ2X01LMjoKICAgICAgICAgICAgICAgIGNhc2UgMjE6IC8vUE5QRW52X1RVTkVSX0ZNMTIxNjoKICAgICAgICAgICAgICAgIGNhc2UgMjQ6IC8vUE5QRW52X1RVTkVSX0ZNMTI0NjoKICAgICAgICAgICAgICAgIGNhc2UgMTc6IC8vUE5QRW52X1RVTkVSX0ZSMTIxNk1GX01LMjoKICAgICAgICAgICAgICAgIGNhc2UgMjI6IC8vUE5QRW52X1RVTkVSX0ZNMTIxNk1GOgogICAgICAgICAgICAgICAgY2FzZSAyMDogLy9QTlBFbnZfVFVORVJfRlIxMjU2X01LMjoKICAgICAgICAgICAgICAgIGNhc2UgMjU6IC8vUE5QRW52X1RVTkVSX0ZNMTI1NjoKICAgICAgICAgICAgICAgIGNhc2UgMzM6IC8vUE5QRW52X1RVTkVSXzQwMzlGUjU6CiAgICAgICAgICAgICAgICBjYXNlIDQyOiAvL1BOUEVudl9UVU5FUl80MDA5RlI1OgogICAgICAgICAgICAgICAgY2FzZSA1MjogLy9QTlBFbnZfVFVORVJfNDA0OUZNNToKICAgICAgICAgICAgICAgIGNhc2UgNTQ6IC8vUE5QRW52X1RVTkVSXzQwNDlGTTVfQWx0STJDOgogICAgICAgICAgICAgICAgY2FzZSA0NDogLy9QTlBFbnZfVFVORVJfNDAwOUZONToKICAgICAgICAgICAgICAgIGNhc2UgMzE6IC8vUE5QRW52X1RVTkVSX1RDUEI5MDg1UDoKICAgICAgICAgICAgICAgIGNhc2UgMzA6IC8vUE5QRW52X1RVTkVSX1RDUE45MDg1RDoKICAgICAgICAgICAgICAgIGNhc2UgNDY6IC8vUE5QRW52X1RVTkVSX1RQMThOU1IwMUY6CiAgICAgICAgICAgICAgICBjYXNlIDQ3OiAvL1BOUEVudl9UVU5FUl9UUDE4UFNCMDFEOgogICAgICAgICAgICAgICAgY2FzZSA0OTogLy9QTlBFbnZfVFVORVJfVEFQQ19JMDAxRDoKICAgICAgICAgICAgICAgIGNhc2UgNjA6IC8vUE5QRW52X1RVTkVSX1RBUEVfUzAwMURfTUszOgogICAgICAgICAgICAgICAgY2FzZSA1NzogLy9QTlBFbnZfVFVORVJfRk0xMjE2TUVfTUszOgogICAgICAgICAgICAgICAgY2FzZSA1OTogLy9QTlBFbnZfVFVORVJfRk0xMjE2TVBfTUszOgogICAgICAgICAgICAgICAgY2FzZSA1ODogLy9QTlBFbnZfVFVORVJfRk0xMjM2X01LMzoKICAgICAgICAgICAgICAgIGNhc2UgNjg6IC8vUE5QRW52X1RVTkVSX1RBUEVfSDAwMUZfTUszOgogICAgICAgICAgICAgICAgY2FzZSA2MTogLy9QTlBFbnZfVFVORVJfVEFQRV9NMDAxRF9NSzM6CiAgICAgICAgICAgICAgICBjYXNlIDc4OiAvL1BOUEVudl9UVU5FUl9UREE4Mjc1QzFfODI5MF9GTToKICAgICAgICAgICAgICAgIGNhc2UgODk6IC8vUE5QRW52X1RVTkVSX1RDTF9NRlBFMDVfMjoKICAgICAgICAgICAgICAgIGNhc2UgOTI6IC8vUE5QRW52X1RVTkVSX1BISUxJUFNfRlExMjM2QV9NSzQ6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIHJldHVybiAwOwp9Cgp2b2lkIHR2ZWVwcm9tX2hhdXBwYXVnZV9hbmFsb2coc3RydWN0IHR2ZWVwcm9tICp0dmVlLCB1bnNpZ25lZCBjaGFyICplZXByb21fZGF0YSkKewoJLyogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQoJKiogVGhlIGhhdXBw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