#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::cerr;
#include <stdexcept>
using std::out_of_range;
#include <limits>
class OUTofRage : public out_of_range
{
public:
OUTofRage()
: out_of_range("Out Of Range\n") {}
} ;
long long fibonacci(long long target, long long numberOne, long long numberTwo);
int main() {
try {
cout << endl << fibonacci(91, 0, 1) << endl << endl;
}
catch( std::exception &ex ) {
std::cout << "error:" << ex.what() << std::endl;
}
return 0;
}
long long fibonacci(long long target, long long numberOne, long long numberTwo)
{
if(std::numeric_limits<decltype(numberOne)>::max() - numberOne < numberTwo)
throw OUTofRage();
if(target == 0)
return numberOne + numberTwo;
return fibonacci(target-1, numberTwo, numberOne + numberTwo);
}