{"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\r\n\u003cp\u003eTakahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east.\u003c/p\u003e\r\n\u003cp\u003eThey start simultaneously at the same point and moves as follows \u003cstrong\u003etowards the east\u003c/strong\u003e:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eTakahashi runs \u003cvar\u003e\\(A_1\\)\u003c/var\u003e meters per minute for the first \u003cvar\u003e\\(T_1\\)\u003c/var\u003e minutes, then runs at \u003cvar\u003e\\(A_2\\)\u003c/var\u003e meters per minute for the subsequent \u003cvar\u003e\\(T_2\\)\u003c/var\u003e minutes, and alternates between these two modes forever.\u003c/li\u003e\r\n\u003cli\u003eAoki runs \u003cvar\u003e\\(B_1\\)\u003c/var\u003e meters per minute for the first \u003cvar\u003e\\(T_1\\)\u003c/var\u003e minutes, then runs at \u003cvar\u003e\\(B_2\\)\u003c/var\u003e meters per minute for the subsequent \u003cvar\u003e\\(T_2\\)\u003c/var\u003e minutes, and alternates between these two modes forever.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eHow many times will Takahashi and Aoki meet each other, that is, come to the same point? We do not count the start of the run. If they meet infinitely many times, report that fact.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq T_i \\leq 100000\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq A_i \\leq 10^{10}\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq B_i \\leq 10^{10}\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(A_1 \\neq B_1\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(A_2 \\neq B_2\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eAll values in input are integers.\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\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(T_1\\)\u003c/var\u003e \u003cvar\u003e\\(T_2\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_1\\)\u003c/var\u003e \u003cvar\u003e\\(A_2\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(B_1\\)\u003c/var\u003e \u003cvar\u003e\\(B_2\\)\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\r\n\u003cp\u003ePrint the number of times Takahashi and Aoki will meet each other.\u003cbr\u003e\r\nIf they meet infinitely many times, print \u003ccode\u003einfinity\u003c/code\u003e instead. \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\u003e1 2\r\n10 10\r\n12 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\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\u003eThey will meet just once, \u003cvar\u003e\\(\\frac{4}{3}\\)\u003c/var\u003e minutes after they start, at \u003cvar\u003e\\(\\frac{40}{3}\\)\u003c/var\u003e meters from where they start.\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\u003e100 1\r\n101 101\r\n102 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003einfinity\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\u003eThey will meet \u003cvar\u003e\\(101, 202, 303, 404, 505, 606, ...\\)\u003c/var\u003e minutes after they start, that is, they will meet infinitely many times.\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\u003e12000 15700\r\n3390000000 3810000000\r\n5550000000 2130000000\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e113\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\u003eThe values in input may not fit into a \u003cvar\u003e\\(32\\)\u003c/var\u003e-bit integer type.\u003c/p\u003e\u003c/section\u003e\r\n"}}]}