﻿from random import *

def X():
    x=0
    p=0
    while p!=2:
        if p==0:
            p=1
            x=x+1
        if p==1:
            a=random()
            if a<0.5:
                p=0
            else:
                p=2
            x=x+1
    return x

