{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eLet \u003cvar\u003e\\(N\\)\u003c/var\u003e be an even number.\u003c/p\u003e\r\n\u003cp\u003eThere is a tree with \u003cvar\u003e\\(N\\)\u003c/var\u003e vertices.\r\nThe vertices are numbered \u003cvar\u003e\\(1, 2, ..., N\\)\u003c/var\u003e.\r\nFor each \u003cvar\u003e\\(i\\)\u003c/var\u003e (\u003cvar\u003e\\(1 \\leq i \\leq N - 1\\)\u003c/var\u003e), the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th edge connects Vertex \u003cvar\u003e\\(x_i\\)\u003c/var\u003e and \u003cvar\u003e\\(y_i\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eSnuke would like to decorate the tree with ribbons, as follows.\u003c/p\u003e\r\n\u003cp\u003eFirst, he will divide the \u003cvar\u003e\\(N\\)\u003c/var\u003e vertices into \u003cvar\u003e\\(N / 2\\)\u003c/var\u003e pairs.\r\nHere, each vertex must belong to exactly one pair.\r\nThen, for each pair \u003cvar\u003e\\((u, v)\\)\u003c/var\u003e, put a ribbon through all the edges contained in the shortest path between \u003cvar\u003e\\(u\\)\u003c/var\u003e and \u003cvar\u003e\\(v\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eSnuke is trying to divide the vertices into pairs so that the following condition is satisfied: \"for every edge, there is at least one ribbon going through it.\"\r\nHow many ways are there to divide the vertices into pairs, satisfying this condition?\r\nFind the count modulo \u003cvar\u003e\\(10^9 + 7\\)\u003c/var\u003e.\r\nHere, two ways to divide the vertices into pairs are considered different when there is a pair that is contained in one of the two ways but not in the other.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e is an even number.\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(2 \\leq N \\leq 5000\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq x_i, y_i \\leq N\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eThe given graph is a tree.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(x_1\\)\u003c/var\u003e \u003cvar\u003e\\(y_1\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(x_2\\)\u003c/var\u003e \u003cvar\u003e\\(y_2\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(x_{N - 1}\\)\u003c/var\u003e \u003cvar\u003e\\(y_{N - 1}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the number of the ways to divide the vertices into pairs, satisfying the condition, modulo \u003cvar\u003e\\(10^9 + 7\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n1 2\r\n2 3\r\n3 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eThere are three possible ways to divide the vertices into pairs, as shown below, and two satisfy the condition: the middle one and the right one.\u003c/p\u003e\r\n\u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/1f94b2288f956c5037e4013a0dc9295f?v\u003d1725626412\"\u003e\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n1 2\r\n1 3\r\n1 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eThere are three possible ways to divide the vertices into pairs, as shown below, and all of them satisfy the condition.\u003c/p\u003e\r\n\u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/846630ea82ec8ec5c53ca6ba72511162?v\u003d1725626412\"\u003e\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n1 2\r\n1 3\r\n3 4\r\n1 5\r\n5 6\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 4","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10\r\n8 5\r\n10 8\r\n6 5\r\n1 5\r\n4 8\r\n2 10\r\n3 6\r\n9 2\r\n1 7\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e672\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}