def fib(n)
return case(n)
when 1; 1
when 0; 0
else fib(n-1)+fib(n-2)
end
end
n=4; sum=0; 1.upto(n) {|x| sum+=fib(x);puts "#{x} = #{fib(x)}"}
puts "SUM = #{sum}"
ZGVmIGZpYihuKQoJcmV0dXJuIGNhc2UobikKCXdoZW4gMTsgMQoJd2hlbiAwOyAwCgllbHNlIGZpYihuLTEpK2ZpYihuLTIpCgllbmQKZW5kCm49NDsgc3VtPTA7IDEudXB0byhuKSB7fHh8IHN1bSs9ZmliKHgpO3B1dHMgIiN7eH0gPSAje2ZpYih4KX0ifQpwdXRzICJTVU0gPSAje3N1bX0i