Problem E: 链表中间结点

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:23 Solved:15

Description

给定一个链表,请你找出中间的节点并输出其值。

如果链表正好有偶数个节点,那么返回中间靠后的那个节点。

Input

输入n+1个数,前n个数均大于或者等于0,最后一个数字是-1代表结束。

Output

输出中间节点的值。

Sample Input Copy

1 2 3 4 -1

Sample Output Copy

3