Given a number N find the sum of all the even valued terms in the fibonacci sequence less than or equal to N.

The first few terms of Fibonacci Numbers are, 1, 1, **2**, 3, 5, **8**, 13, 21, **34**, 55, 89, **144**, 233 ,… (Even numbers are highlighted).

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the integer N.

**Output:**

Print the sum of all the even valued terms in the fibonacci sequence less than or equal to given N. Print the answer for each test case in a new line.

**Constraints:**

1<= T <=100

1<= N <=1000000

**Example:
Input:**

2

8

400

**Output:**

10

188

Author: sujnesh

Shahbazuddin Zaidi | 109 |

SunkyuHwang | 108 |

bhatabhi554 | 104 |

sanu123 | 98 |

cass1 | 91 |

blackshadows | 872 |

SunkyuHwang | 612 |

codechaser | 561 |

Shaurya Khanna | 409 |

JojiJoseph | 396 |

akhayrutdinov | 5041 |

Ibrahim Nash | 4919 |

blackshadows | 4572 |

Quandray | 4346 |

sanjay05 | 3668 |

Login to report an issue on this page.