Title: Railway Lines

There is a railway line with double tracks (up and down tracks allowing trains to pass each other anywhere). The line has 11 stations, including terminal stations, and each section between stations is referred to by a segment number shown in the diagram.

Two trains depart simultaneously from both terminal stations and run without stopping. Create a program that reads the length of each section and the speeds of the two trains, and outputs the segment number where the trains pass each other for each case. If they pass exactly at a station, output the smaller segment number. Ignore the length of the trains and stations.

Input:
Multiple datasets are given in the following format:
l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,v1,v2
li (1 ≤ li ≤ 2,000) represents the length of segment i in kilometers. v1 is the speed of the train departing from terminal 1 (km/h), and v2 is the speed of the train departing from terminal 10 (km/h) (1 ≤ v1, v2 ≤ 2,000). The number of datasets does not exceed 50.

Output:
For each dataset, output the segment number where the trains pass each other on a single line.

Sample Input:
1,1,1,1,1,1,1,1,1,1,40,60
1,1,1,1,1,3,3,3,3,3,50,50
10,10,10,10,10,10,10,10,10,10,50,49

Output for the Sample Input:
4
7
6

# Buggy version:
while True:
    try:
        l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,v1,v2=map(int,input().split(","))
        kyo=0
        for i in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10:
            kyo +=i
        v=v1+v2
        x=kyo/v
        ans=v1*x
        flag=0
        for j in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,0:
            if ans>0:
                ans -=j
                flag +=1
                print(ans)
            else:
                print(flag)
                break
    except:break


# Fixed version:
while True:
    try:
        l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,v1,v2=map(int,input().split(","))
        kyo=0
        for i in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10:
            kyo +=i
        v=v1+v2
        x=kyo/v
        ans=v1*x
        flag=0
        for j in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,0:
            if ans>0:
                ans -=j
                flag +=1
            else:
                print(flag)
                break
    except:break

# Buggy version:
while True:
    try:
        A = list(map(int,input().split(',')))
    except EOFError:
        break
    V1 = A [-2]
    V2 = A [-1]
    del A [-1]
    del A [-1]

    for i in range(len(A)):
        A [i] *= V1 + V2

    point = sum(A) // (V1 + V2) * V1
    print(point)
    for i in range(len(A)):
        if sum(A [0:i + 1]) >= point:
            print(i + 1)
            break

# Fixed version:
while True:
    try:
        A = list(map(int,input().split(',')))
    except EOFError:
        break
    V1 = A [-2]
    V2 = A [-1]
    del A [-1]
    del A [-1]

    for i in range(len(A)):
        A [i] *= V1 + V2

    point = sum(A) // (V1 + V2) * V1
    for i in range(len(A)):
        if sum(A [0:i + 1]) >= point:
            print(i + 1)
            break

# Buggy version:
import sys
for line in sys.stdin:
    v = list(map(int, line.split(",")))
    k = [sum(v[:i]) for i,j in enumerate(v[:-1])]
    l = v[-2]/(v[-1]+v[-2]) * k[-1]
    n = [a-l if a-l >= 0 else 1e10 for a in k]
    print(n)
    print(n.index(min(n)))

# Fixed version:
import sys
for line in sys.stdin:
    v = list(map(int, line.split(",")))
    k = [sum(v[:i]) for i,j in enumerate(v[:-1])]
    l = v[-2]/(v[-1]+v[-2]) * k[-1]
    n = [a-l if a-l >= 0 else 1e10 for a in k]
    print(n.index(min(n)))