Kostya likes the number 4 much. Of course! This number has such a lot of properties, like:

- Four is the smallest composite number;
- It is also the smallest Smith number;
- The smallest non-cyclic group has four elements;
- Four is the maximal degree of the equation that can be solved in radicals;
- There is four-color theorem that states that any map can be colored in no more than four colors in such a way that no two adjacent regions are colored in the same color;
- Lagrange's four-square theorem states that every positive integer can be written as the sum of at most four square numbers;
- Four is the maximum number of dimensions of a real division algebra;
- In bases 6 and 12, 4 is a 1-automorphic number;
- And there are a lot more cool stuff about this number!

Impressed by the power of this number, Kostya has begun to look for occurrences of four anywhere. He has a list of T integers, for each of them he wants to calculate the number of occurrences of the digit 4 in the decimal representation. He is too busy now, so please help him.

-----Input-----
The first line of input consists of a single integer T, denoting the number of integers in Kostya's list.
Then, there are T lines, each of them contain a single integer from the list.

-----Output-----
Output T lines. Each of these lines should contain the number of occurences of the digit 4 in the respective integer from Kostya's list.

-----Constraints-----
- 1 ≤ T ≤ 105
- (Subtask 1): 0 ≤ Numbers from the list  ≤ 9 - 33 points.
- (Subtask 2): 0 ≤ Numbers from the list  ≤ 109 - 67 points.

-----Example-----
Input:
5
447474
228
6664
40
81

Output:
4
0
1
1
0

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
x=int(input())
for i in range(x):
    h=input()
    print(h.count('4'))


t = int(input())
for i in range(t):
    v = input()
    l = len(v)
    d ="4"
    c = 0
    for i in range(l):
        if(v[i] == d):
            c+=1
    print(c)    
    
    


# cook your dish here

n = int(input())
for i in range(n):
    number = str(input())
    print(number.count("4"))

# cook your dish here
n=int(input())
a=[]
for i in range (0,n):
    no=int(input())
    a.append(no)
for i in range (0,n):
    c=0
    while (a[i]!=0):
        if (a[i]%10==4):
            c+=1
        a[i]=a[i]//10
    print(c)

t=eval(input())
'''for i in range(t):
    s=input()
    print(s.count("4"))
'''

# second way is

for i in range(t):
    rem=[]
    n=eval(input())
    while(n>0):
        rem.append(n%10)
        n=n//10
    print(rem.count(4))



# cook your dish here
from collections import Counter
for _ in range(int(input())):
    n= Counter(input().strip())
    print(n['4'])


n= int(input())
for i in range(n):
    s=0
    a=input()
    for j in range(len(a)):
        if a[j]=='4':
            s+=1 
    print(s)

# cook your dish here
n = int(input())
while n>0:
    s=input()
    print(len(s.split('4'))-1)
    n = n-1

# cook your dish here
for t in range(int(input())):
	n=str(input())
	count=0
	for i in n:
		if i!="4":
			pass
		else:
			count+=1
	print(count)		

a=str(4)
for _ in range(int(input())):
    n=str(input())
    count=0
    for i in n:
        if i==a:
            count+=1
    print(count)

from collections import Counter
n=int(input())
for i in range(n):
    k=list(input())
    c=Counter(k)
    print(c['4'])

def four():
  n=input()
  count=0
  for i in n:
    if int(i)==0:
      continue
    else:
      if int(i)==4:
        count+=1
  print(count) 

for _ in range(int(input())):
  four()

# cook your dish here
try:
    t=int(input())
    
    
    while(t!=0):
        t-=1
        n=input()
        
        k=0
        for j in range(0,len(n)):
            if(n[j]=='4'):
                k+=1
        print(k)
    
except:pass           

# cook your dish here
n=int(input())
for i in range(n):
    s=input()
    c=s.count('4')
    print(c)


n=int(input())
mylist=[]
while n>0:
    num=input()
    count=0
    for i in num:
        if i=='4':
            count+=1
    mylist.append(count)
    n=n-1
for i in mylist:
    print(i)
           


t = int(input())
for i in range(t):
    a = int(input())
    count = 0
    while a != 0:
        if a % 10 == 4:
            count +=1
        a = a // 10
    print(count)
    


# cook your dish here
t = int(input())
while t:
    t-=1
    n = input()
    print(n.count('4'))

n=int(input())
for i in range(n):
    a=int(input())
    c=0
    while a:
        r=a%10
        if(r==4):
            c=c+1
        a=a//10
    print(c)

n=int(input())
for i in range(n):
    a=int(input())
    c=0
    while a:
        r=a%10
        if(r==4):
            c=c+1
        a=a//10
    print(c)

arr=[]
for a in range(int(input())):
    b=list(input())
    if "4" in b:
        arr.append(b.count('4'))
    else:
        arr.append(0)
print(*arr, sep='\n')


# cook your dish here
t = int(input())
for i in range(t):
    n = input()
    print(n.count("4"))

for _ in range (int(input())):
    l = list(input())
    print(l.count('4'))


#Read the number of test cases.
T = int(input())
for tc in range(T):
	# Read number
	num = int(input())
	count = 0
	while num:
	    rem = num %10
	    if rem ==4:
	        count+=1
	    num = num//10
	print(count)

t=int(input())
i=0
while i<t:
    i=i+1
    n=int(input())
    sum=0
    
    while n>0:
        if n%10==4:
            sum=sum+1
            n=n//10
        
        else:
            n=n//10
    print(sum)