There is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 stations on this line, including the terminal station, and each station is called by the section number shown in the figure.
Trains depart from both terminal stations on this line at the same time and run without stopping along the way. Create a program that reads the length of each section and the speed of the two trains and outputs the number of the section where the trains pass each other in each case. However, if you pass each other just at the station, the smaller number of the section numbers on both sides will be output. In addition, the length of the train and the length of the station cannot be ignored.
Input
Multiple datasets are given. Each dataset is given in the following format.
l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, v1, v2
li (1 ≤ li ≤ 2,000) is an integer representing the length (km) of the interval i. v1 is the speed of the train departing from the terminal station on the section 1 side (km / h), and v2 is the speed of the train departing from the terminal station on the section 10 side (km / h) (1 ≤ v1, v2) ≤ 2,000).
The number of datasets does not exceed 50.
Output
For each data set, the number of the section where the train passes is output on one line.
We need to parse the problem. There is a double-track line with up and down separate lines, meaning trains run on opposite directions on separate tracks? Actually "double-track line (up and down are separate lines and pass each other everywhere)" means there are two parallel tracks, one for each direction, so they can pass each other anywhere without conflict. The problem describes a line with 11 stations including terminal stations, each station is called by the section number shown in the figure. The figure is not provided but it's typical: sections between stations. So there are 11 stations, numbered from start to end? Probably section numbers refer to the segments between stations. Usually there are 10 sections between 11 stations. They give l1,...,l10 as lengths of intervals (sections). So stations are at boundaries: station 0 at start of section 1 (left terminal), station 1 between section1 and section2, ... station 10 at end of section10 (right terminal). So the trains depart from both terminal stations at same time and run without stopping along the way. So train A starts at left terminal (station 0) going to the right? Or "depart from both terminal stations on this line" one train starts at the terminal station on section 1 side, meaning the leftmost terminal (starting point of section1) and the other starts at the terminal station on the section 10 side (rightmost terminal) and presumably go towards each other (since they will pass each other). So they run on separate tracks? Actually "pass each other" means they cross paths (meet) but since they are on separate tracks, they can pass without conflict. So effectively it's like two points moving towards each other on a line of length total L = sum_{i=1}^{10} l_i. Train 1 (v1) starts at left end (position 0) moving rightwards. Train 2 (v2) starts at right end (position L) moving leftwards. They start simultaneously. The question: "outputs the number of the section where the trains pass each other in each case. However, if you pass each other just at the station, the smaller number of the section numbers on both sides will be output." So we need to find at which section they meet. The meeting point could be within a section (i.e., not at a station), then we output the section number (i) where the meeting point lies. If they meet exactly at a station (i.e., at the boundary between section i and i+1, which is station i), then we output the smaller of the two section numbers on both sides: i.e., if at station between section i and i+1, then the two sides are sections i and i+1, so output min(i, i+1) = i. Actually station i (1-indexed?) Wait careful: Stations are called by the section number shown in the figure. Need to deduce station numbering. Usually if there are 11 stations, they might be numbered 1 to 11, but the problem says "including the terminal station, and each station is called by the section number shown in the figure." Possibly the figure shows the sections numbered 1 to 10 and the stations are numbered according to the section to its left? Or something else. Let's search memory: This is a known problem from some online judge, maybe "Section" problem. I recall a problem: "There is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 stations on this line, including the terminal station, and each station is called by the section number shown in the figure." I think the typical answer is to compute meeting point and find the section number. Usually the stations are at positions: station 0 (terminal) at start, station 1 after l1, station 2 after l1+l2,... station 10 after all sections. The sections are numbered 1..10, so the section i is between station i-1 and station i. Then the train from left starts at station 0, train from right at station 10. They meet at some point. If they meet exactly at a station j (j from 1 to 9, because stations 0 and 10 are terminals? Actually they could meet at terminal stations? Possibly not because they start at the same time and travel towards each other; they would meet somewhere in between; meeting at a terminal would only happen if one train is stationary? but v1, v2 >=1, so they will meet somewhere inside). So if they meet exactly at station j (j from 1 to 9), then they are at the boundary between section j and j+1? Let's check: Station j is at position sum_{i=1}^{j} l_i. That is the end of section j and start of section j+1. So the point is between section j and j+1. The problem says: "if you pass each other just at the station, the smaller number of the section numbers on both sides will be output." So sections on both sides: left side is section j, right side is section j+1. Smaller number is j. So output j. So that's consistent: if exactly at station j, output j (the lower section index). So indeed stations are numbered by the preceding section? Or maybe station numbers correspond to the section after them? But it says "smaller number of the section numbers on both sides". So if meeting at station j, the sections on both sides are j and j+1, so output j. So if meeting exactly at a station, we output the left section number.
Now, if meeting inside a section i (i from 1 to 10), then we output i.
So basically we compute total distance L. They start at time t=0, positions x1=0 moving at v1, x2 = L moving at -v2. They meet when x1 + v1 t = x2 - v2 t => (v1+v2) t = L => t = L/(v1+v2). At that time, the position of train1 is x = v1 * t = v1 * L/(v1+v2). So we need to find which section contains x, where sections: section i is from cumulative sum_{k=1}^{i-1} l_k to cumulative sum_{k=1}^{i} l_k. Usually we have cumulative distances from left: Let cum[0] = 0, cum[i] = sum_{k=1}^{i} l_k for i=1..10. Then section i is interval (cum[i-1], cum[i]). Station positions: cum[i] for i=0..10.
We need to find i such that cum[i-1] < x < cum[i] (strictly). If x equals exactly cum[i] for some i from 1 to 9 (or maybe also i=0 or i=10 but those are terminals, they would only meet at terminals if one train doesn't move? But since both moving towards each other, they will meet somewhere between; x = 0 would imply v1=0? not allowed; x = L would imply v2=0? not allowed. So terminals not considered). If x == cum[i] for i=1..9, then meeting at station i, output i.
Thus answer is straightforward: compute L, compute x = v1 * L/(v1+v2). Then find i where cum[i-1] <= x < cum[i]; if x == cum[i-1]? Actually could it be exactly at the left endpoint of a section? The left endpoint of section i is cum[i-1] which is also station i-1. But if x equals cum[i-1] for i>1, that means they meet at station i-1. That case would be caught as x == cum[i-1] so it's exactly at station i-1. According to rule, output the smaller section number on both sides: sections i-1 and i? Actually station i-1 is between section i-1 and section i. So we should output min(i-1, i) = i-1. So if x == cum[i-1] and i-1 >0, we output i-1. But our loop searching for i where cum[i-1] < x < cum[i] would not include the equality at left boundary. So we need to handle equality separately. However, note that if x==0 (i=0) not possible. If x == cum[i] for i=1..9, that's right boundary of section i, then output i. So better approach: find the smallest i (1-indexed sections) such that x <= cum[i]. Actually typical: find the first cumulative sum that is >= x. Then if x == cum[i] exactly, meeting at station i, output i. If x < cum[i], then it's within section i, but also need to ensure that if x equals cum[i-1] exactly (i.e., x == cum[i-1]), then that would be caught by the condition x <= cum[i-1]? Actually if x == cum[i-1], then the first cum >= x would be cum[i-1] because cum[i-1] >= x. But we need to treat equality at a station as outputting the smaller section number among the two sides. At station i-1, sections are i-1 and i; the smaller is i-1. So if we detect x == cum[k] for some k (1<=k<=9), we output k. But if x == 0 (k=0) not possible, if x==L (k=10) not possible. So we just need to check if x exactly equals any cumulative sum (cum[1]...cum[9]) and if so, output that index. Otherwise, find i where cum[i-1] < x < cum[i] (i.e., x > cum[i-1] and x < cum[i]) and output i.
But what if x is exactly at cum[0]? Not possible. So algorithm: compute L = sum(l1..l10). Compute x = (v1 * L) / (v1 + v2). Since lengths are integers, v1, v2 integers, but x may be rational. We need to treat it as a floating point number? Could be non-integer. However, the condition of exact station meeting occurs if x equals exactly cum[i] (integer). So we can compute as rational to avoid precision issues. Since L, v1, v2 are integers up to 2000, L <= 102000 = 20000? Actually each li up to 2000, sum up to 20000. v1+v2 up to 4000. So x is rational number = (v1L) / (v1+v2). We can compute using integer arithmetic by cross-multiplication when comparing to cumulative sums (integers). Let numerator = v1 * L, denominator = v1+v2. So x = numerator / denominator (real). We need to find i such that x lies in section i or exactly at station.
We can find the meeting position in terms of distance from left. Instead of float, compute time t (maybe not needed). We can compute which section by comparing distances proportionally.
We can check equality: x == cum[i] <=> numerator/denominator == cum[i] <=> numerator == cum[i] * denominator.
Otherwise, for checking if x < cum[i], we can compare numerator < cum[i] * denominator. For x > cum[i], numerator > cum[i] * denominator.
So we can find the smallest i such that numerator < cum[i] * denominator? Actually we need to find the section where it lies. Approach: compute cumulative sums. For i from 1 to 10: if numerator == cum[i] * denominator -> output i (station). else if numerator < cum[i] * denominator -> then x < cum[i]; since x >= cum[i-1]? We also need to ensure x > cum[i-1] if not equality. We can check: if numerator > cum[i-1] * denominator and numerator < cum[i] * denominator -> then inside section i -> output i. But we also need to handle case where x == cum[i-1]? That would be equality at station i-1, which we would have caught when i-1 was checked? So we can first check all stations for equality (i=1..9). Then if none, then do a loop to find the i where cum[i-1] * denominator < numerator < cum[i] * denominator.
Simpler: compute numerator and denominator. Then for i from 1 to 10:
if numerator == cum[i] * denominator: answer = i; break;
else if numerator < cum[i] * denominator: answer = i; break; // because then x < cum[i] and since no equality at previous cum[i-1] (we would have caught if equal), it implies x > cum[i-1] (since we didn't break earlier at i-1 equality). But wait: suppose x is exactly cum[i-1] and i-1 >=1. In the loop i-1, we would have checked if numerator == cum[i-1]*denom, and would have output i-1 and break before reaching i. So indeed if we check stations for equality as we go, we can then for each i check equality; if not, check if numerator < cum[i]*denom, then we know x < cum[i]. But we also need to ensure x > cum[i-1] to guarantee it's within section i, not exactly at cum[i-1] (which would have been caught earlier). So if we haven't broken on equality for any j <= i-1, then numerator != cum[j]*denom for j < i, in particular for j=i-1, so numerator > cum[i-1]*denom? Actually it could be that numerator > cum[i-1]*denom? If numerator > cum[i-1]*denom and numerator < cum[i]*denom, then indeed it's inside section i. But what if numerator < cum[i]*denom but also numerator <= cum[i-1]*denom? Could numerator be less than cum[i-1]*denom? That would mean x < cum[i-1]. But we would have already encountered that at earlier i? For i-1, we would have checked if numerator < cum[i-1]*denom. In the loop for i-1, if numerator < cum[i-1]*denom, we would have output i-1? That would be wrong if x < cum[i-1] but not > cum[i-2]? Let's think: The loop logic: iterate i from 1 to 10; at each i, we check equality first; if not equal, check if numerator < cum[i]*denom. If that is true, we output i and break. But if x is less than cum[i-1], then at i=1, cum[1] is the first cum. If x < cum[1], then numerator < cum[1]*denom, so we would output i=1 and break. But is it possible that x < cum[1]? Yes, if the meeting point is in section 1, then x < cum[1]. But also x > cum[0] = 0. That's fine. So the logic: if numerator < cum[i]*denom, then we know x < cum[i]. Additionally, if we haven't broken earlier, that means for all j < i, numerator was not < cum[j]*denom? Actually we break as soon as we meet the condition. So at i=1, we would break if numerator < cum[1]*denom, giving answer 1. That is correct if x is within section 1 (or exactly at cum[1]? Equality would have been caught). If x is exactly 0? Not possible. So it works.
But consider x exactly at cum[i-1]? Then at i-1 we would have equality, we output i-1, break. So never reach i. So the simple approach works: iterate i from 1 to 10; if numerator == cum[i] * denominator -> answer = i; break; else if numerator < cum[i] * denominator -> answer = i; break; If none? At i=10, cum[10]=L. numerator/denom = v1L/(v1+v2). Is it possible that numerator >= cum[10]denom? numerator = v1L, denominator = v1+v2, cum[10]denom = L * denominator. Compare numerator vs Ldenom: numerator = v1L, Ldenom = L(v1+v2) = v1L + v2L. Since v2>0, Ldenom > numerator, so numerator < Ldenom always (since v2>0). So at i=10, we will always have numerator < cum[10]*denom, because v2>0. So we will break at i=10 if not earlier. So algorithm is fine.
Thus answer is just the first section i such that the meeting point is <= the end of that section. However, careful: The condition "if you pass each other just at the station, the smaller number of the section numbers on both sides will be output." So if meeting exactly at station i, we should output i. That's exactly what we do with equality check.
But is that consistent? Let's test: Example input 1: all li=1, v1=40, v2=60. L=10. numerator = 40*10=400, denominator=100, so x=4. So meeting at exactly position 4. Cum sums: cum[1]=1,2,3,4,5,... Actually cum[4]=4. So equality at i=4 => output 4. That matches example output 4.
Example 2: 1,1,1,1,1,3,3,3,3,3,50,50 => lengths: first five are 1, next five are 3. L = 51 +53=5+15=20. v1=v2=50. So numerator = 50*20=1000, denominator=100, x=10. Cum sums: 1,2,3,4,5,8,11,14,17,20. At x=10, which is after cum[5]=5 and before cum[6]=8? Actually cum[6]=8? Wait recalc: cum[1]=1; cum[2]=2; cum[3]=3; cum[4]=4; cum[5]=5; cum[6]=5+3=8; cum[7]=11; cum[8]=14; cum[9]=17; cum[10]=20. So x=10 lies between cum[7]=11? Actually 10 is between 8 and 11: cum[6]=8, cum[7]=11. So inside section 7? Section 7 is from cum[6] to cum[7] (i.e., 8 to 11). So answer should be 7. And the example output is 7. Our algorithm: numerator=1000, denom=100. Compare to cum[i]100:
i=1: 1100=100 < 1000 -> not less
i=2: 200<1000
i=3:300<1000
i=4:400<1000
i=5:500<1000
i=6:800<1000
i=7:1100 > 1000, so numerator < 1100? Actually check condition: numerator < cum[i]*denom? At i=7, cum[7]*100 = 1100, numerator=1000, so 1000 < 1100 true. So we break at i=7, output 7. No equality before. That's correct.
Example 3: 10,10,10,10,10,10,10,10,10,10,50,49. All li=10, L=100. v1=50, v2=49. numerator = 50*100 = 5000, denominator=99, so x = 5000/99 ≈ 50.50505... Cum sums: 10,20,...,100. The position is >50? Actually 5000/99 ≈ 50.505. That is between 50 and 60: cum[5]=50, cum[6]=60. So inside section 6 (since section 6 from 50 to 60). Output should be 6. Example output is 6. Check algorithm: cum[1]*99=990 <5000; cum[2]*99=1980<5000; cum[3]*99=2970<5000; cum[4]*99=3960<5000; cum[5]*99=4950<5000; cum[6]*99=5940>5000 -> numerator<5940 true, so break at i=6, output 6. So correct.
Thus the algorithm works.
Now the input format: "l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, v1, v2" separated by commas, possibly with spaces? The example shows "1,1,1,1,1,1,1,1,1,1,40,60" so it's just comma-separated values, no spaces? Actually there are no spaces in example. But problem statement says "l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, v1, v2" possibly with spaces after commas? Might not, but we can parse by reading the whole line and splitting on commas, trimming whitespace. Input includes multiple datasets, each on its own line. The number of datasets not exceeding 50. So we read until EOF.
We need to output one integer per dataset.
Edge cases: if meeting exactly at station, we output that station number i (as per equality). Already handled.
Potential tricky: Since the lengths are integers, the cum[i] are integers, numerator and denominator are integers. The equality condition may be exact if numerator equals cum[i] * denominator. But note that denominator = v1+v2 may not be an integer? Actually v1 and v2 are integers, so denominator is integer. So equality check is integer comparison. Good.
Thus implement.
But I'm ChatGPT, so produce final answer: code in Python (likely they expect C or something, but the problem is from some old contest maybe language independent). We'll write in Python.
Implementation steps:
While True: read a line from stdin (strip). If line is empty break.
Split line on commas (','). There might be spaces? So for each token, strip whitespace, convert to int.
Should be exactly 12 numbers.
l = list of first 10 ints, v1 = int(tokens[10]), v2 = int(tokens[11]).
Compute cum = [0]*11. Actually easier: compute cumulative sums cum[i] for i from 1..10 as described.
L = sum(l)
numerator = v1 * L
denominator = v1 + v2
For i in range(1, 11):
cum_i = cum[i-1] + l[i-1] (if using 0-indexed l)
if numerator == cum_i * denominator:
ans = i
break
if numerator < cum_i * denominator:
ans = i
break
Print ans.
We should note that cum_i * denominator may overflow? In Python int is arbitrary, fine. But in C, we might need 64-bit, but here Python is okay.
Now check corner cases: Could numerator be exactly equal to cum[10]*denominator? That would require numerator = L * denominator => v1 * L = L * (v1+v2) => v1 = v1+v2 => v2=0, not allowed. So not happen.
What if numerator < 0? No.
Thus it's good.
Now we need to output the answer.
But wait: The problem states "the length of the train and the length of the station cannot be ignored." Huh? That phrase seems odd: "In addition, the length of the train and the length of the station cannot be ignored." Might indicate that trains have length and stations have length? Usually in such problems, they consider the length of the train and stations, i.e., the physical length of trains and stations matters when determining passing? But here it says "the length of the train and the length of the station cannot be ignored." That suggests that trains have some length and stations have some length, which might affect where they meet? However, the problem doesn't provide lengths for trains or stations; it only provides section lengths. The phrase might be a red herring or translation artifact. Possibly it means that we cannot consider trains as points, but they have length. However, we aren't given any train length or station length. So maybe it's just saying that we must consider the physical dimensions? That seems odd. Let's parse the original problem statement more carefully: "There is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 stations on this line, including the terminal station, and each station is called by the section number shown in the figure.
Trains depart from both terminal stations on this line at the same time and run without stopping along the way. Create a program that reads the length of each section and the speed of the two trains and outputs the number of the section where the trains pass each other in each case. However, if you pass each other just at the station, the smaller number of the section numbers on both sides will be output. In addition, the length of the train and the length of the station cannot be ignored."
Maybe "the length of the train and the length of the station cannot be ignored." means that we should consider the trains as having length, but no values are given. Possibly they assume that the train length and station length are zero? That phrase might be indicating that the distance between stations is measured from the start of one station to the start of the next? Or that the station platform length matters? Actually in some problems, they might consider that the station has a certain length and the train length also matters for when the train occupies the station. However, here the trains do not stop, they just pass through stations. So perhaps they want to consider that the train's front and back? The phrase might be a mistranslation; maybe it means "the length of the train and the length of the station cannot be ignored" implying that when two trains pass each other, if they are at a station, the point of passing might be somewhere within the station. But they haven't provided lengths, so perhaps it's simply stating that the stations are points? Actually typical problem: "Double track line, trains depart from both terminals, find the section where they meet." Usually it's just the meeting point of two points moving. Maybe the phrase "the length of the train and the length of the station cannot be ignored" is to emphasize that we consider the trains and stations have length, but the input doesn't provide them; maybe they assume the length of train is zero and station length is zero? That would be ignoring them. So contradictory.
Let's search memory: I recall an Aizu Online Judge problem "Railway Lines" or something? Or maybe from "Japanese Olympiad in Informatics"? There is a problem called "Section" or "Train" where you have sections and stations, and you have to find where trains meet. I vaguely recall that there is a nuance: The train lengths are not negligible, so when two trains meet, you consider the point where the fronts meet? Or where the trains start overlapping? But it says "pass each other", maybe when the fronts cross? Usually in such problems, we treat trains as points because lengths are not given, but they explicitly say "cannot be ignored". However, they didn't give any length values. So maybe they assume trains have zero length? Or maybe the problem originally had lengths for trains and stations but was simplified? Actually the sample data only gives section lengths and speeds. So likely the phrase is just a note that we can't assume station points are zero length and trains are points, but the actual solution still uses point model because the additional lengths cancel out? Let's think: If trains have length L_train and stations have length L_station? But no numbers.
Maybe they intend that the stations are not points but have platforms; the train length might be considered but they might have assumed the train length is zero? No.
Perhaps the phrase is part of the problem statement to remind that the distance between stations is measured from the near end of platforms? Actually if stations have length, then the "section" lengths are probably the distances between station boundaries (like from end of one station to start of next). And trains have length, so when a train is at a station, its front and back may be at different positions. However, since trains are not stopping, maybe we don't need to consider that. But the phrase "cannot be ignored" suggests we must account for it. Maybe they want to define the "pass each other" as when the fronts cross? Usually that's standard even with length considered; the meeting point is when the front of one meets the front of the other (assuming they are on parallel tracks). That point is independent of train length. So length doesn't matter. So maybe it's just a confusing addition.
I think the intended solution is exactly as we derived.
But to be thorough, let's examine if any subtlety: "the length of the train and the length of the station cannot be ignored." Could mean that when they pass at a station, we need to consider the station's physical length and perhaps the train's length may affect which section is considered "the section where the trains pass each other"? But the rule: "if you pass each other just at the station, the smaller number of the section numbers on both sides will be output." So if the fronts meet exactly at the boundary, we output the lower section. That seems to treat stations as points. If stations have length, then the station occupies some interval; maybe passing "just at the station" means they meet somewhere within the station area. But then the output rule is the smaller section number. Without lengths, we can't define the station interval. So likely stations are considered points.
Thus I'll proceed with point model.
Now confirm with sample input: we got correct outputs.
Thus final code is simple.
Potential pitfalls: Input lines may have spaces after commas. Our parsing should handle that.
Also multiple lines; read until EOF.
We should ensure that when reading from sys.stdin, lines may have trailing newline; we strip.
Now I'll produce final answer.
But I'm asked: "There is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 stations on this line, including the terminal station, and each station is called by the section number shown in the figure.
"
In the actual problem, there might be a figure that illustrates sections numbered 1..10. So we treat as described.
Thus final code.
Now produce answer: Provide Python solution with while loop.
Edge Cases: v1 and v2 could be up to 2000, L up to 20000, denominator up to 4000, numerator up to 40 million, cum_i * denominator up to 20000*4000=80 million, within Python int.
Now I'll code.
Potential alternative: could compute using fractions.
Let's do:
import sys
def solve():
out_lines = []
for line in sys.stdin:
line = line.strip()
if not line:
continue
parts = [p.strip() for p in line.split(',')]
if len(parts) < 12:
continue
nums = list(map(int, parts))
l = nums[:10]
v1 = nums[10]
v2 = nums[11]
L = sum(l)
num = v1 * L
den = v1 + v2
cum = 0
ans = None
for i, li in enumerate(l, start=1):
cum += li
if num == cum * den:
ans = i
break
if num < cum * den:
ans = i
break
# Should always break, but just in case
out_lines.append(str(ans))
sys.stdout.write("\n".join(out_lines))
if name == "main":
solve()
That's it.
But before finalizing, let's test with given examples.
Example 3: all 10s, v1=50, v2=49 => L=100; num=5000; den=99; cum after each:10->990, 5000<990 false;20->1980 false;30->2970 false;40->3960 false;50->4950 false;60->5940, 5000<5940 true -> ans=6.
Works.
Now I'm ready to output final answer.
But the problem might originally expect reading until EOF and outputs each answer line. So that's fine.
Now I'll produce final answer.
Potential nuance: if the meeting point is exactly at a station, and we output the station number? But station numbers: maybe they are numbered from 1 to 11? In our mapping, stations are at positions cum[0] to cum[10]; we output the section number on the left, which for station i (i from 1 to 9) is i. But the problem says "the smaller number of the section numbers on both sides will be output." So for station i (between section i and i+1), output i. So that's correct. For station 0? Not happen. For station 10? Not happen.
Thus all good.
Now I'll output code in Python.
Given that the problem might be from an old contest that expects C/C++/Java, but we can answer with Python.
Now I'll write final answer.
```python
import sys
def solve() -> None:
out_lines = []
for line in sys.stdin:
line = line.strip()
if not line:
continue
# split by commas and remove possible surrounding spaces
parts = [p.strip() for p in line.split(',')]
# there must be exactly 12 numbers
if len(parts) < 12:
continue
nums = list(map(int, parts))
l = nums[:10] # lengths of the 10 sections
v1, v2 = nums[10], nums[11]
code
total = sum(l) # total length L
numerator = v1 * total
denominator = v1 + v2
cum = 0 # cumulative distance from left terminal
answer = None
for i, length in enumerate(l, start=1):
cum += length # cum = Li
if numerator == cum * denominator:
answer = i # exactly at station i
break
if numerator < cum * denominator:
answer = i # inside section i
break
# The loop always breaks (v2 > 0 guarantees numerator < L*denominator)
out_lines.append(str(answer))
sys.stdout.write("\n".join(out_lines))