title: Fibonacci Sum of Large Numbers(Only Last Digit to be Printed)
body: <p>I have been trying to come out with a solution regarding the problem of finding the last digit of the sum of large n Fibonacci series. 
  I have been able to pass several test cases with large n. But I'm stuck at the following case where n = 832564823476. I know it can be solved using Pisano's period but I'm unable to come out with a efficient algo. Any help would be great. Thanks.
  My code that I have implemented is as follows-</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  
  int calc_fib(int n) {
  
      int fib[n+1];
      fib[0]=0;
      fib[1]=1;
      int res = 1;
      for(int i = 2; i&lt;=n;i++){
          fib[i] = (fib[i-1]%10 + fib[i-2]%10)%10;
          res = res + fib[i];
      }
      return (res%10);
  }
  
  int main() {
      int n = 0;
      std::cin &gt;&gt; n;
  
      std::cout &lt;&lt; calc_fib(n) &lt;&lt; '\n';
      return 0;
  }
  </code></pre>