class Solution:
    def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]:
        now = head
        length = 0
        while now:
            length += 1
            now = now.next
        now = head

        # addition = 0 if length % 2 else 1 # len is odd: 0, even: 1
        addition = 0
        for i in range(length // 2 + addition):
            now = now.next

        return now

852b13ea950ac5171e53d15ef306fdb14b213098
<mask token>

class Solution:
    <mask token>

class Solution:

    def middleNode(self, head: Optional[ListNode]) ->Optional[ListNode]:
        now = head
        length = 0
        while now:
            length += 1
            now = now.next
        now = head
        addition = 0
        for i in range(length // 2 + addition):
            now = now.next
        return now

class Solution:
    def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]:
        now = head
        length = 0
        while now:
            length += 1
            now = now.next
        now = head

        # addition = 0 if length % 2 else 1 # len is odd: 0, even: 1
        addition = 0
        for i in range(length // 2 + addition):
            now = now.next

        return now
