%%% -*- mode: erlang -*-
%%% $Id: fibo.erlang,v 1.2 2000/12/24 19:10:50 doug Exp $
%%% http://www.bagley.org/~doug/shootout/

-module(fibo).
-export([main/1]).

main() -> main(['1']).
main([Arg]) ->
    Num = list_to_integer(atom_to_list(Arg)),
    io:fwrite("~w\n", [fib(Num)]),
    halt(0).

fib(N) when N < 2 -> 1;
fib(N) -> fib(N-2) + fib(N-1).