Lately, Mr. Chanek frequently plays the game Arena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia.

The game is played by two people taking turns, where Mr. Chanek takes the first turn. Initially, there is a treasure chest containing N gold coins. The game ends if there are no more gold coins in the chest. In each turn, the players can make one of the following moves:

  * Take one gold coin from the chest. 
  * Take half of the gold coins on the chest. This move is only available if the number of coins in the chest is even. 



Both players will try to maximize the number of coins they have. Mr. Chanek asks your help to find the maximum number of coins he can get at the end of the game if both he and the opponent plays optimally.

Input

The first line contains a single integer T (1 ≤ T ≤ 10^5) denotes the number of test cases.

The next T lines each contain a single integer N (1 ≤ N ≤ 10^{18}).

Output

T lines, each line is the answer requested by Mr. Chanek.

Example

Input


2
5
6


Output


2
4

Note

For the first case, the game is as follows: 

  1. Mr. Chanek takes one coin. 
  2. The opponent takes two coins. 
  3. Mr. Chanek takes one coin. 
  4. The opponent takes one coin. 



For the second case, the game is as follows: 

  1. Mr. Chanek takes three coins. 
  2. The opponent takes one coin. 
  3. Mr. Chanek takes one coin. 
  4. The opponent takes one coin. 
# # Author Name: Ajay Meena
# # Codeforce : https://codeforces.com/profile/majay1638

# # -------- IMPORTANT ---------#
# # SUN BHOS**KE AGAR MERA TEMPLATE COPY KAR RHA HAI NA TOH KUCH CHANGES BHI KAR DENA ESS ME, VARNA MUJEHY WARNING AAYEGI BAAD ME, PLEASE YAAR KAR DENA, OK :).
# import sys
# import bisect
# from bisect import bisect_right

# import math
# from sys import stdin, stdout
# # //Most Frequently Used Number Theory Concepts
# # VAISE MEIN JAYDA USE KARTA NHI HU ENHE BUT COOL BANNE KE LIYE LIKH LEYA TEMPLATE ME VARNA ME YE TOH DUSRI FILE MAI SE BHI COPY PASTE KAR SAKTA THA :).


# def sieve(N):
#     primeNumbers = [True]*(N+1)
#     primeNumbers[0] = False
#     primeNumbers[1] = False
#     i = 2
#     while i*i <= N:
#         j = i
#         if primeNumbers[j]:
#             while j*i <= N:
#                 primeNumbers[j*i] = False
#                 j += 1
#         i += 1
#     return primeNumbers


# def getPrime(N):
#     primes = sieve(N)
#     result = []
#     for i in range(len(primes)):
#         if primes[i]:
#             result.append(i)
#     return result


# def factor(N):
#     factors = []
#     i = 1
#     while i*i <= N:
#         if N % i == 0:
#             factors.append(i)
#             if i != N//i:
#                 factors.append(N//i)
#         i += 1
#     return sorted(factors)


# def gcd(a, b):
#     if a < b:
#         return gcd(b, a)
#     if b == 0:
#         return a
#     return gcd(b, a % b)


# def extendedGcd(a, b):
#     if a < b:
#         return extendedGcd(b, a)
#     if b == 0:
#         return [a, 1, 0]
#     res = extendedGcd(b, a % b)
#     x = res[2]
#     y = res[1]-(math.floor(a/b)*res[2])
#     res[1] = x
#     res[2] = y
#     return res


# def iterativeModularFunc(a, b, c):
#     res = 1
#     while b > 0:
#         if b & 1:
#             res = (res*a) % c
#         a = (a*a) % c
#         b = b//2
#     return res

# # TAKE INPUT
# # HAAN YE BHUT KAAM AATA HAI INPUT LENE ME


# def get_ints_in_variables():
#     return map(int, sys.stdin.readline().strip().split())


# def get_int(): return int(input())


# def get_ints_in_list(): return list(
#     map(int, sys.stdin.readline().strip().split()))


# def get_list_of_list(n): return [list(
#     map(int, sys.stdin.readline().strip().split())) for _ in range(n)]


# def get_string(): return sys.stdin.readline().strip()


# def Solution(n):
#     ans = 0
#     while n != 0:
#         if n == 4:
#             ans += 3
#             n = 0
#             continue
#         if n % 4 == 0:
#             n -= 2
#             ans += 1
#         else:
#             ans += (n // 2)
#             n = (n // 2) - 1
#     return ans


# def main():
#     # //Write Your Code Here
#     for _ in range(get_int()):
#         n = get_int()
#         ans = 0
#         if (n % 2 == 0):
#             ans = Solution(n)
#         else:
#             ans = n - Solution(n - 1)
#         print(ans)


# #  calling main Function
# if __name__ == "__main__":
#     main()
from sys import stdin
input = stdin.readline


def max_pos_coins(n):
    a = 0
    while n != 0:
        if n == 4:
            a += 3
            n = 0
            continue
        if n % 4 == 0:
            n -= 2
            a += 1
        else:
            a += n // 2
            n = n // 2 - 1
    return a


for _ in range(int(input())):
    n = int(input())
    print(max_pos_coins(n) if n % 2 == 0 else n - max_pos_coins(n - 1))
