from modelverse import *
import sys

init()
login("test_service", "my_password")

def fibonacci_service(port):
    def fibonacci(value):
        if value <= 2:
            return 1
        else:
            return fibonacci(value - 1) + fibonacci(value - 2)

    service_set(port, fibonacci(service_get(port)))
    
service_register("fibonacci", fibonacci_service)

# Stay active, as we shouldn't exit while the service is running!
if sys.version_info[0] < 3:
    while raw_input() != "STOP":
        pass
else:
    while input() != "STOP":
        pass

service_stop()
