While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bitwise AND is equal to s. As this number can be large, output it modulo 10^9 + 7.

To represent the string as a number in numeral system with base 64 Vanya uses the following rules:  digits from '0' to '9' correspond to integers from 0 to 9;  letters from 'A' to 'Z' correspond to integers from 10 to 35;  letters from 'a' to 'z' correspond to integers from 36 to 61;  letter '-' correspond to integer 62;  letter '_' correspond to integer 63. 


-----Input-----

The only line of the input contains a single word s (1 ≤ |s| ≤ 100 000), consisting of digits, lowercase and uppercase English letters, characters '-' and '_'.


-----Output-----

Print a single integer — the number of possible pairs of words, such that their bitwise AND is equal to string s modulo 10^9 + 7.


-----Examples-----
Input
z

Output
3

Input
V_V

Output
9

Input
Codeforces

Output
130653412



-----Note-----

For a detailed definition of bitwise AND we recommend to take a look in the corresponding article in Wikipedia.

In the first sample, there are 3 possible solutions:   z&_ = 61&63 = 61 = z  _&z = 63&61 = 61 = z  z&z = 61&61 = 61 = z

Difficulty: MEDIUM
Tags: String algorithms

Bit manipulation

Combinatorics

Implementation
Skill types: Bit manipulation

Starter code:

Solutions:
from itertools import chain
data = input()
MOD = 10 ** 9 + 7
translate = [chr(x) for x in chain(list(range(ord('0'), ord('9') + 1)), list(range(ord('A'), ord('Z') + 1)), list(range(ord('a'), ord('z') + 1)), [ord('-'), ord('_')])]
assert len(translate) == 64
translate2 = {k: '{:0>6}'.format(bin(i)[2:]).count('0') for (i, k) in enumerate(translate)}
x = sum([translate2[ch] for ch in data])
print(3 ** x % MOD)


s = input().strip()
m = {}
for i in range(10):
	m[str(i)] = i
for i in range(ord('Z') - ord('A') + 1):
	m[chr(ord('A') + i)] = 10 + i
for i in range(ord('z') - ord('a') + 1):
	m[chr(ord('a') + i)] = 36 + i
m['-'] = 62
m['_'] = 63
zero_bits = 0
for c in s:
	n = m[c]
	for i in range(6):
		zero_bits += int(not n & 1)
		n >>= 1
res = 1
for z in range(zero_bits):
	res = res * 3 % 1000000007
print(res)


mod = 10 ** 9 + 7
resp = 1
s = input()

def between(n, a, b):
	return n >= a and n <= b
for i in s:
	if between(i, '0', '9'):
		i = ord(i) - ord('0')
	elif between(i, 'A', 'Z'):
		i = ord(i) - ord('A') + 10
	elif between(i, 'a', 'z'):
		i = ord(i) - ord('a') + 36
	elif i == '-':
		i = 62
	else:
		i = 63
	for j in range(6):
		if i >> j & 1 == 0:
			resp = 3 * resp % mod
print(resp)


s = input()
enc = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
d = dict()
for i in range(len(enc)):
	d[enc[i]] = i
ans = 0
for c in s:
	x = bin(d[c])
	x = x.rjust(8, '0')
	ans += x.count('0') - 1
M0D = 10 ** 9 + 7
print(pow(3, ans, M0D))


s = input()
ans = [0 for i in range(64)]
for i in range(len(ans)):
	temp = bin(i)
	ans[i] = temp.count('0') - 1 + (6 - (len(temp) - 2))
pri = 10 ** 9 + 7
count = 1
for i in range(len(s)):
	if s[i].isdigit():
		r = bin(int(s[i]))
		r = r[2:]
		count = count * pow(3, ans[int(s[i])], pri)
		count %= pri
	elif s[i] == '-':
		count = count * pow(3, ans[62], pri)
		count %= pri
	elif s[i] == '_':
		count = count * pow(3, ans[63], pri)
		count %= pri
	elif 65 <= ord(s[i]) <= 91:
		count = count * pow(3, ans[ord(s[i]) - 65 + 10], pri)
		count %= pri
	elif 97 <= ord(s[i]) <= 122:
		count = count * pow(3, ans[ord(s[i]) - 97 + 36], pri)
		count %= pri
print(count % pri)


(s, ans) = (input(), 1)
for x in s:
	if '0' <= x <= '9':
		t = ord(x) - 48
	if 'A' <= x <= 'Z':
		t = ord(x) - 55
	if 'a' <= x <= 'z':
		t = ord(x) - 61
	if x == '-':
		t = 62
	if x == '_':
		t = 63
	ans = ans * 3 ** (6 - bin(t).count('1')) % 1000000007
print(ans)


chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
d = {}
cnt = 0
for i in chars:
	d[i] = cnt
	cnt += 1
s = input()
ans = 1
mod = 10 ** 9 + 7
for i in s:
	x = bin(d[i])
	x = x.split('b')
	x = x[1]
	p = 0
	for j in x:
		if j == '0':
			ans = ans * 3 % mod
		p += 1
	ans = ans * 3 ** (6 - p) % mod
print(ans)


MOD = 1000000007

def main():
	opts = [0] * 64
	for i in range(64):
		for j in range(64):
			opts[i & j] += 1
	s = input()
	n = len(s)
	ans = 1
	for c in s:
		if '0' <= c <= '9':
			ans *= opts[ord(c) - ord('0')]
			ans %= MOD
		elif 'A' <= c <= 'Z':
			ans *= opts[ord(c) - ord('A') + 10]
			ans %= MOD
		elif 'a' <= c <= 'z':
			ans *= opts[ord(c) - ord('a') + 36]
			ans %= MOD
		elif c == '-':
			ans *= opts[62]
			ans %= MOD
		else:
			ans *= opts[63]
			ans %= MOD
	print(ans)
main()


from math import log

def f(s):
	s = s[::-1]
	a = {}
	cons = 0
	for i in range(10):
		a[str(i)] = cons
		cons += 1
	for i in 'abcdefghijklmnopqrstuvwxyz'.upper():
		a[i] = cons
		cons += 1
	for i in 'abcdefghijklmnopqrstuvwxyz':
		a[i] = cons
		cons += 1
	a['-'] = 62
	a['_'] = 63
	ans = 1
	for i in s:
		pp = a[i]
		tc = bin(a[i]).lstrip('0b')
		tc = '0' * (6 - len(tc)) + tc
		ans *= 3 ** tc.count('0')
		ans %= 10 ** 9 + 7
	return ans
print(f(input()))


def main():
	s = input()
	number = ''
	ans = 1
	for c in s:
		if c >= '0' and c <= '9':
			number = bin(int(c))[2:]
		elif c >= 'A' and c <= 'Z':
			number = bin(ord(c) - 55)[2:]
		elif c >= 'a' and c <= 'z':
			number = bin(ord(c) - 61)[2:]
		elif c == '-':
			number = bin(62)[2:]
		else:
			number = bin(63)[2:]
		if len(number) < 6:
			diff = 6 - len(number)
			for i in range(diff):
				number += '0'
		for digit in number:
			if digit == '0':
				ans = ans * 3 % 1000000007
	print(ans)
main()


s = input()
freq = [0] * 64
for i in range(64):
	for j in range(64):
		freq[i & j] += 1
mod = 10 ** 9 + 7
ans = 1
for i in s:
	if '0' <= i <= '9':
		b = int(i)
	elif 'A' <= i <= 'Z':
		b = ord(i) - ord('A') + 10
	elif 'a' <= i <= 'z':
		b = ord(i) - ord('a') + 36
	elif i == '-':
		b = 62
	else:
		b = 63
	ans *= freq[b]
	ans %= mod
print(ans)


import sys
chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
mp = {}
for i in range(len(chars)):
	mp[chars[i]] = i
zero = 0
s = sys.stdin.readline()
for i in range(len(s) - 1):
	zero += sum([i == '0' for i in format(mp[s[i]], '06b')])
print(pow(3, zero, int(1000000000.0 + 7)))


z = input()
l = []
for x in z:
	if ord(x) >= ord('0') and ord(x) <= ord('9'):
		l.append(ord(x) - ord('0'))
	elif ord(x) >= ord('A') and ord(x) <= ord('Z'):
		l.append(ord(x) - ord('A') + 10)
	elif ord(x) >= ord('a') and ord(x) <= ord('z'):
		l.append(ord(x) - ord('a') + 36)
	elif ord(x) == ord('-'):
		l.append(62)
	else:
		l.append(63)
ans = 1
for i in l:
	unset = 6 - bin(i).count('1')
	for x in range(unset):
		ans *= 3
		while ans >= 1000000007:
			ans -= 1000000007
print(ans)


def get_num(sym):
	if sym in '0123456789':
		return int(sym)
	if sym == '-':
		return 62
	if sym == '_':
		return 63
	if ord('a') <= ord(sym) <= ord('z'):
		return ord(sym) - ord('a') + 36
	else:
		return ord(sym) - ord('A') + 10

def bins(x):
	return bin(x)[2:]
p = 10 ** 9 + 7
s = input()
ans = 1
for sym in s:
	now = bins(get_num(sym))
	now = '0' * (6 - len(now)) + now
	for i in now:
		if i is '0':
			ans *= 3
	ans %= p
print(ans)


import math
mod = int(10 ** 9 + 7)
N = int(100000.0) + 10

def main():
	d = {}
	for i in range(10):
		d[str(i)] = i
	i = 10
	for j in range(26):
		c = str(chr(ord('A') + j))
		d[c] = i
		i += 1
	for j in range(26):
		c = str(chr(ord('a') + j))
		d[c] = i
		i += 1
	d['-'] = i
	d['_'] = i + 1
	s = input()
	ans = 1
	temp = [0 for i in range(64)]
	for i in range(64):
		for j in range(64):
			temp[i & j] += 1
	l = [d[c] for c in s]
	for j in l:
		ans = (temp[j] * ans + mod) % mod
	print(ans)
main()


def Bina(n):
	s = ''
	while n != 0:
		s += str(n % 2)
		n = n // 2
	return s

def Zeros(b):
	ones = 0
	for i in range(b.__len__()):
		if '1' == b[i]:
			ones += 1
	return 6 - ones
total = 1
alphabet = list('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-')
dic = {}
num = 0
for i in alphabet:
	dic[i] = Zeros(Bina(alphabet.index(i)))
M = int(1000000000.0 + 7)
for i in input():
	if i == '_':
		continue
	num = dic[i]
	total = total * 3 ** num % M
print(total)


mod = 1000000007
resp = 1

def between(c, l, r):
	return ord(c) >= ord(l) and ord(c) <= ord(r)
s = input()
for i in s:
	if between(i, '0', '9'):
		i = ord(i) - ord('0')
	elif between(i, 'A', 'Z'):
		i = ord(i) - ord('A') + 10
	elif between(i, 'a', 'z'):
		i = ord(i) - ord('a') + 36
	elif i == '-':
		i = 62
	else:
		i = 63
	for j in range(6):
		if i >> j & 1 == 0:
			resp = 3 * resp % mod
print(resp)


import sys
import math

def bitfield(n):
	return [int(digit) for digit in bin(n)[2:]]

def getzeros(n):
	result = 0
	bf = bitfield(n)
	for i in bf:
		if i == 0:
			result += 1
	result += 6 - len(bf)
	return result

def getnum(ch):
	if ord(ch) == ord('-'):
		return 62
	if ord(ch) == ord('_'):
		return 63
	if ord(ch) - ord('0') <= 9:
		return ord(ch) - ord('0')
	if 10 + ord(ch) - ord('A') <= 35:
		return 10 + ord(ch) - ord('A')
	if 36 + ord(ch) - ord('a') <= 61:
		return 36 + ord(ch) - ord('a')
combinations = dict()
for i in '0123456789':
	combinations[i] = 3 ** getzeros(getnum(i))
for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
	combinations[i] = 3 ** getzeros(getnum(i))
for i in 'abcdefghijklmnopqrstuvwxyz':
	combinations[i] = 3 ** getzeros(getnum(i))
combinations['-'] = 3 ** getzeros(getnum('-'))
combinations['_'] = 3 ** getzeros(getnum('_'))
word = input()
result = 1
for i in word:
	result = result * combinations[i] % 1000000007
print(result)


from string import ascii_lowercase, ascii_uppercase
from collections import defaultdict
idx = ''
for i in range(10):
	idx += str(i)
idx += ascii_uppercase
idx += ascii_lowercase
idx += '-_'
md = 10 ** 9 + 7
vals = defaultdict(list)
for i in range(64):
	for j in range(64):
		el1 = idx[i]
		el2 = idx[j]
		res = i & j
		elres = idx[res]
		vals[elres].append([el1, el2])
s = input()
ans = 1
for i in s:
	ans = ans % md * (len(vals[i]) % md) % md
print(ans)


import string
symbol = ''.join(map(str, range(10))) + string.ascii_uppercase + string.ascii_lowercase + '-_'
d = dict([(symbol[i], i) for i in range(len(symbol))])
s = input()
ans = 1
for i in s:
	for j in range(6):
		if d[i] & 1 << j == 0:
			ans = ans * 3 % 1000000007
print(ans)


from collections import defaultdict
import sys
input = sys.stdin.readline
print = sys.stdout.write
s = input()
d = {}
for i in range(0, 10):
	d[i] = str(i)
for i in range(10, 36):
	d[i] = chr(i + 55)
for i in range(36, 62):
	d[i] = chr(i + 61)
d[62] = '-'
d[63] = '_'
rep = defaultdict(int)
for j in range(64):
	for k in range(64):
		rep[d[j & k]] += 1
mod = 10 ** 9 + 7
ans = 1
for i in range(len(s) - 1):
	ans = ans * rep[s[i]] % mod
print(str(ans))


from collections import defaultdict
s = input()
s1 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
d = defaultdict(int)
for i in range(64):
	for j in range(64):
		d[s1[i & j]] += 1
ans = 1
for ch in s:
	ans = ans * d[ch] % (10 ** 9 + 7)
print(ans)


s = input()
m = dict()
a = dict()
m['-'] = 62
m['_'] = 63
for i in range(10):
	m[str(i)] = i
for i in range(26):
	m[chr(65 + i)] = 10 + i
for i in range(26):
	m[chr(97 + i)] = 36 + i
for x in range(64):
	for j in range(64):
		a[x & j] = a.get(x & j, 0) + 1
ans = 1
for c in s:
	ans = ans * a.get(m[c], 0) % 1000000007
print(ans)


word = input()
count = 0
for s in word:
	count = count - 2
	if s == '0':
		count += 8
	elif s == '1':
		count += 7
	elif s == '2':
		count += 7
	elif s == '3':
		count += 6
	elif s == '4':
		count += 7
	elif s == '5':
		count += 6
	elif s == '6':
		count += 6
	elif s == '7':
		count += 5
	elif s == '8':
		count += 7
	elif s == '9':
		count += 6
	elif s == 'A':
		count += 6
	elif s == 'B':
		count += 5
	elif s == 'C':
		count += 6
	elif s == 'D':
		count += 5
	elif s == 'E':
		count += 5
	elif s == 'F':
		count += 4
	elif s == 'G':
		count += 7
	elif s == 'H':
		count += 6
	elif s == 'I':
		count += 6
	elif s == 'J':
		count += 5
	elif s == 'K':
		count += 6
	elif s == 'L':
		count += 5
	elif s == 'M':
		count += 5
	elif s == 'N':
		count += 4
	elif s == 'O':
		count += 6
	elif s == 'P':
		count += 5
	elif s == 'Q':
		count += 5
	elif s == 'R':
		count += 4
	elif s == 'S':
		count += 5
	elif s == 'T':
		count += 4
	elif s == 'U':
		count += 4
	elif s == 'V':
		count += 3
	elif s == 'W':
		count += 7
	elif s == 'X':
		count += 6
	elif s == 'Y':
		count += 6
	elif s == 'Z':
		count += 5
	elif s == 'a':
		count += 6
	elif s == 'b':
		count += 5
	elif s == 'c':
		count += 5
	elif s == 'd':
		count += 4
	elif s == 'e':
		count += 6
	elif s == 'f':
		count += 5
	elif s == 'g':
		count += 5
	elif s == 'h':
		count += 4
	elif s == 'i':
		count += 5
	elif s == 'j':
		count += 4
	elif s == 'k':
		count += 4
	elif s == 'l':
		count += 3
	elif s == 'm':
		count += 6
	elif s == 'n':
		count += 5
	elif s == 'o':
		count += 5
	elif s == 'p':
		count += 4
	elif s == 'q':
		count += 5
	elif s == 'r':
		count += 4
	elif s == 's':
		count += 4
	elif s == 't':
		count += 3
	elif s == 'u':
		count += 5
	elif s == 'v':
		count += 4
	elif s == 'w':
		count += 4
	elif s == 'x':
		count += 3
	elif s == 'y':
		count += 4
	elif s == 'z':
		count += 3
	elif s == '-':
		count += 3
	elif s == '_':
		count += 2
print(3 ** count % 1000000007)


s = input()
v = []
for l in s:
	if 48 <= ord(l) <= 57:
		v.append(ord(l) - 48)
	elif 65 <= ord(l) <= 90:
		v.append(ord(l) - 55)
	elif 97 <= ord(l) <= 122:
		v.append(ord(l) - 61)
	elif l == '-':
		v.append(62)
	elif l == '_':
		v.append(63)
assert len(v) == len(s)
mods = [0] * 64
for i in range(64):
	for j in range(64):
		mods[i & j] += 1
(ans, MOD) = (1, 10 ** 9 + 7)
for x in v:
	ans *= mods[x]
	ans %= MOD
print(ans)


d = {}
for i in range(10):
	temp = i
	bits = 0
	while temp > 0:
		if temp & 1:
			bits += 1
		temp = temp >> 1
	d[str(i)] = 6 - bits
curr = 10
for i in range(26):
	temp = curr
	bits = 0
	while temp > 0:
		if temp & 1:
			bits += 1
		temp = temp >> 1
	d[chr(ord('A') + i)] = 6 - bits
	curr += 1
for i in range(26):
	temp = curr
	bits = 0
	while temp > 0:
		if temp & 1:
			bits += 1
		temp = temp >> 1
	d[chr(ord('a') + i)] = 6 - bits
	curr += 1
d['-'] = 6 - 5
d['_'] = 6 - 6
s = input()
ans = 1
for i in s:
	ans = ans * 3 ** d[i] % (10 ** 9 + 7)
print(ans % (10 ** 9 + 7))


from collections import defaultdict

def convert(x):
	val = 0
	if x >= '0' and x <= '9':
		val = int(x)
	if x >= 'A' and x <= 'Z':
		val = ord(x) - ord('A')
		val += 10
	if x >= 'a' and x <= 'z':
		val = ord(x) - ord('a')
		val += 36
	if x == '-':
		val = 62
	if x == '_':
		val = 63
	return val
S = input()
words = []
MOD = 10 ** 9 + 7
cnt = defaultdict(int)
for x in range(10):
	words.append(str(x))
for x in range(ord('A'), ord('Z') + 1):
	words.append(chr(x))
for x in range(ord('a'), ord('z') + 1):
	words.append(chr(x))
words.append('-')
words.append('_')
for x in range(len(words)):
	for y in range(len(words)):
		if x == y:
			val = x & y
			cnt[val] += 1
		else:
			val = x & y
			cnt[val] += 1
result = 1
for x in S:
	val = convert(x)
	tmp = cnt[val]
	result *= tmp
	result %= MOD
print(result % MOD)


from math import factorial
b = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6]
d = {'N': 23, '9': 9, 'g': 42, '3': 3, '4': 4, 'Q': 26, 'K': 20, 'S': 28, 'A': 10, 'x': 59, 'B': 11, 'I': 18, 'n': 49, '7': 7, '-': 62, 'J': 19, 'm': 48, '5': 5, 'O': 24, 'L': 21, 'u': 56, 'r': 53, 'Z': 35, 'M': 22, 'j': 45, 'v': 57, 'q': 52, 'X': 33, 't': 55, 'a': 36, 's': 54, 'z': 61, 'Y': 34, 'd': 39, 'p': 51, 'o': 50, 'f': 41, 'P': 25, 'V': 31, '_': 63, 'w': 58, 'C': 12, 'R': 27, 'b': 37, 'E': 14, '0': 0, 'G': 16, 'k': 46, 'l': 47, 'D': 13, 'W': 32, 'T': 29, '8': 8, 'U': 30, 'F': 15, '2': 2, 'c': 38, 'h': 43, 'y': 60, 'i': 44, 'e': 40, '6': 6, 'H': 17, '1': 1}
MOD = 1000000000.0 + 7
max_dig = 6
ans = 1
s = input()
for c in s:
	nul_num = max_dig - b[d[c]]
	ans *= 3 ** nul_num
	ans %= MOD
print(int(ans))


def ordd(s):
	if s == '-':
		return 62
	elif s == '_':
		return 63
	elif s in '0123456789':
		return int(s)
	elif ord('a') <= ord(s) <= ord('z'):
		return ord(s) - 61
	elif ord('A') <= ord(s) <= ord('Z'):
		return ord(s) - 55
s = input()
b = ''
res = 1
h = ''
for i in range(0, len(s)):
	h = bin(ordd(s[i]))[2:]
	d = '0' * (6 - len(h))
	b += d + h
print(3 ** b.count('0') % (10 ** 9 + 7))


import sys

def convert(x):
	if x >= 'A' and x <= 'Z':
		return ord(x) - ord('A') + 10
	if x >= 'a' and x <= 'z':
		return ord(x) - ord('a') + 36
	if x >= '0' and x <= '9':
		return ord(x) - ord('0')
	if x == '-':
		return 62
	return 63

def ones(n):
	r = 0
	while n != 0:
		n &= n - 1
		r += 1
	return r

def zeros(x):
	return 6 - ones(x)

def pow(a, b, mod=10 ** 9 + 7):
	res = 1
	while b > 0:
		if b & 1 == 0:
			a = a * a % mod
			b = b >> 1
		else:
			res = res * a % mod
			b -= 1
	return res

def main():
	x = sys.stdin.readline().rstrip()
	t = 0
	for s in x:
		v = convert(s)
		z = zeros(v)
		t += z
	print(pow(3, t))
main()


s = input()
MOD = 10 ** 9 + 7
a = {}
b = []
k = 0
for i in range(ord('0'), ord('9') + 1):
	a[chr(i)] = k
	k += 1
	b.append(chr(i))
for i in range(ord('A'), ord('Z') + 1):
	a[chr(i)] = k
	k += 1
	b.append(chr(i))
for i in range(ord('a'), ord('z') + 1):
	a[chr(i)] = k
	k += 1
	b.append(chr(i))
(a['-'], a['_']) = (62, 63)
b.append('-')
b.append('_')
cnt = {}
for i in b:
	cnt[i] = 0
for i in b:
	for j in b:
		cnt[b[a[i] & a[j]]] += 1
ans = 1
for i in s:
	ans = ans * cnt[i] % MOD
print(ans)


d = [0] * 64
for i in range(64):
	for j in range(64):
		d[i & j] += 1
s = input()
ans = 1
for i in s:
	if '0' <= i <= '9':
		ans *= d[int(i)]
	elif 'A' <= i <= 'Z':
		ans *= d[ord(i) - ord('A') + 10]
	elif 'a' <= i <= 'z':
		ans *= d[ord(i) - ord('a') + 10 + 26]
	elif i == '-':
		ans *= d[62]
	elif i == '_':
		ans *= d[63]
	ans %= 10 ** 9 + 7
print(ans)


import string

def zero_count(n):
	return bin(63 - n).count('1')
E = string.digits + string.ascii_uppercase + string.ascii_lowercase + '-_'
D = {c: zero_count(i) for (i, c) in enumerate(E)}
p = 10 ** 9 + 7
s = input().rstrip()
ans = sum((D[c] for c in s))
print(pow(3, ans, p))


mod = int(1000000000.0) + 7
between = lambda x, y, z: ord(x) >= ord(y) and ord(x) <= ord(z)
s = input()
r = 1
for i in s:
	if between(i, '0', '9'):
		i = ord(i) - ord('0')
	elif between(i, 'A', 'Z'):
		i = ord(i) - ord('A') + 10
	elif between(i, 'a', 'z'):
		i = ord(i) - ord('a') + 36
	elif i == '-':
		i = 62
	else:
		i = 63
	for j in range(6):
		if i >> j & 1 == 0:
			r = 3 * r % mod
print(r)


num = list(range(10))
bword = list(range(10, 36))
sword = list(range(36, 62))
bigconst = 65
smallconst = 97
ans = 1
s = input()
for i in range(len(s)):
	if s[i] >= '0' and s[i] <= '9':
		k = int(s[i])
	elif s[i] >= 'A' and s[i] <= 'Z':
		k = bword[ord(s[i]) - bigconst]
	elif s[i] >= 'a' and s[i] <= 'z':
		k = sword[ord(s[i]) - smallconst]
	elif s[i] == '-':
		k = 62
	else:
		k = 63
	k = bin(k)
	ans = ans * 3 ** (k.count('0') - 1 + (6 - (len(k) - 2))) % (10 ** 9 + 7) % (10 ** 9 + 7)
print(ans % (10 ** 9 + 7))


import sys

def minp():
	return sys.stdin.readline().strip()
alpha = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
V = dict()
for i in range(len(alpha)):
	for j in range(len(alpha)):
		k = i & j
		V[k] = V.get(k, 0) + 1
s = minp()
r = 1
for i in range(len(s)):
	k = alpha.find(s[i])
	r = r * V[k] % 1000000007
print(r)


all = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
s = input()
ans = 1
for c in s:
	pos = all.find(c)
	cnt = int(0)
	cnt += (pos + 1) % 2
	pos //= 2
	cnt += (pos + 1) % 2
	pos //= 2
	cnt += (pos + 1) % 2
	pos //= 2
	cnt += (pos + 1) % 2
	pos //= 2
	cnt += (pos + 1) % 2
	pos //= 2
	cnt += (pos + 1) % 2
	pos //= 2
	for i in range(0, cnt):
		ans *= 3
		ans %= 1000000007
print(ans)


x = input()
a = []
for c in x:
	if 48 <= ord(c) <= 57:
		a.append(ord(c) - 48)
	elif 65 <= ord(c) <= 90:
		a.append(ord(c) - 55)
	elif 97 <= ord(c) <= 122:
		a.append(ord(c) - 61)
	elif c == '-':
		a.append(62)
	elif c == '_':
		a.append(63)
m = 10 ** 9 + 7
ans = 1
for num in a:
	for c in '{0:06b}'.format(num):
		if c == '0':
			ans *= 3
			ans %= m
print(ans)


string = input()

def entre(i, a, b):
	return ord(i) >= ord(a) and ord(i) <= ord(b)
resp = 1
for char in string:
	if entre(char, '0', '9'):
		i = ord(char) - ord('0')
	elif entre(char, 'A', 'Z'):
		i = ord(char) - ord('A') + 10
	elif entre(char, 'a', 'z'):
		i = ord(char) - ord('a') + 36
	elif char == '-':
		i = 62
	else:
		i = 63
	for j in range(6):
		if i >> j & 1 == 0:
			resp = resp * 3 % 1000000007
print(resp)


from functools import reduce
s = input()
m = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
d = {}
for i in range(len(m)):
	b = bin(i).replace('0b', '')
	d[m[i]] = 3 ** (6 - len(b) + b.count('0'))
k = 10 ** 9 + 7
print(reduce(lambda x, y: x * y % k, [d[c] for c in s], 1) % k)


s = input()
chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
counts = [729, 243, 243, 81, 243, 81, 81, 27, 243, 81, 81, 27, 81, 27, 27, 9, 243, 81, 81, 27, 81, 27, 27, 9, 81, 27, 27, 9, 27, 9, 9, 3, 243, 81, 81, 27, 81, 27, 27, 9, 81, 27, 27, 9, 27, 9, 9, 3, 81, 27, 27, 9, 27, 9, 9, 3, 27, 9, 9, 3, 9, 3, 3, 1]
s_counts = [None] * 64
for i in range(64):
	s_counts[i] = s.count(chars[i])
result = 1
for i in range(64):
	result *= counts[i] ** s_counts[i]
print(result % (10 ** 9 + 7))


def main():
	l = [0] * 123
	for (i, c) in enumerate('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'):
		l[ord(c)] = '{:0>6b}'.format(i).count('0')
	print(pow(3, sum((l[ord(c)] for c in input())), 1000000007))
main()


def str_to_array(s):
	array = [None] * len(s)
	for (i, c) in enumerate(s):
		code = ord(c)
		if 48 <= code <= 57:
			array[i] = code - 48
		elif 65 <= code <= 90:
			array[i] = code - 55
		elif 97 <= code <= 122:
			array[i] = code - 61
		elif code == 45:
			array[i] = 62
		elif code == 95:
			array[i] = 63
	return array

def calculate_for_one_number(number):
	r = 1
	for _ in range(6):
		digit = number & 1
		if digit == 0:
			r *= 3
		number >>= 1
	return r
inp = str_to_array(input())
result = 1
for n in inp:
	result *= calculate_for_one_number(n)
	result %= 1000000007
print(result)


d = {}

def init():
	l = []
	for item in range(10):
		l.append(str(item))
	for item in range(ord('A'), ord('Z') + 1):
		l.append(chr(item))
	for item in range(ord('a'), ord('z') + 1):
		l.append(chr(item))
	l.append('-')
	l.append('_')
	for (i, item) in enumerate(l):
		d[item] = '{0:06b}'.format(i).count('0')
init()
ret = 0
for item in input():
	ret += d[item]
print(3 ** ret % (10 ** 9 + 7))


import math
mod = 1000000000 + 7
s = list(input())
lis = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-', '_']
c = 0
n = len(s)
t = 0
for i in s[::-1]:
	a = lis.index(i)
	aa = bin(a).replace('0b', '')
	for j in aa:
		if j == '0':
			c += 1
	c += 6 - len(aa)
print(pow(3, c, mod))


conversaoBase64 = {'-': 62, '_': 63}
for j in range(0, 10):
	conversaoBase64[str(j)] = j
j = 10
for i in range(ord('A'), ord('Z') + 1):
	conversaoBase64[chr(i)] = j
	j += 1
j = 36
for i in range(ord('a'), ord('z') + 1):
	conversaoBase64[chr(i)] = j
	j += 1
palavra = list(input())
cont = 0
for letra in palavra:
	letraBase64 = conversaoBase64[letra]
	for i in range(6):
		if letraBase64 >> i & 1 == 0:
			cont += 1
c = 1000000007
print(3 ** cont % c)


s = input()
ans = 1
d = {'-': 62, '_': 63}
ad = {}
for i in range(10):
	d[str(i)] = i
for i in range(10, 36):
	d[chr(i + 55)] = i
for i in range(36, 62):
	d[chr(i + 61)] = i

def adn(x):
	(res, t) = (0, d[x])
	for i in range(64):
		for j in range(64):
			if j & i == t:
				res += 1
	return res
for x in d:
	ad[x] = adn(x)
for x in s:
	ans = ans * ad[x] % 1000000007
print(ans)


def noof0(strin):
	s = 0
	l = len(strin)
	for item in strin:
		if item == str(0):
			s += 1
	return s + 6 - l
string = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
array = []
for item in string:
	array.append(item)

def g(a, n, m):
	if n == 0:
		return 1
	elif n % 2 == 0:
		return g(a, n // 2, m) ** 2 % m
	else:
		return g(a, n // 2, m) ** 2 * a % m

def value(s):
	for i in range(64):
		if array[i] == s:
			return i
inp = input()
s = 0
for item in inp:
	s += noof0(str(bin(value(item)))[2:])
print(g(3, s, 1000000007))


def orf(x):
	if x == '-':
		return 62
	if x == '_':
		return 63
	x = ord(x)
	if x in range(ord('0'), ord('9') + 1):
		return x - ord('0')
	if x in range(ord('A'), ord('Z') + 1):
		return x - ord('A') + 10
	if x in range(ord('a'), ord('z') + 1):
		return x - ord('a') + 36
U = 1
a = input()
for i in a:
	d = bin(orf(i))[2:]
	d = '0' * (6 - len(d)) + d
	for m in d:
		if m == '0':
			U = U * 3 % (10 ** 9 + 7)
print(U)


mod = pow(10, 9) + 7
ans = 1
d = {}
string = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
for i in range(64):
	for j in range(64):
		if i & j in d:
			d[i & j] += 1
		else:
			d[i & j] = 1
s = input()
for i in s:
	x = string.index(i)
	ans = ans % mod * (d[x] % mod) % mod
print(ans)


s = input()
(bit, mp, ID, res, MOD) = ({}, {}, 0, 1, int(1000000000.0 + 7))
for i in range(10):
	bit[chr(i + ord('0'))] = ID
	ID += 1
for i in range(26):
	bit[chr(i + ord('A'))] = ID
	ID += 1
for i in range(26):
	bit[chr(i + ord('a'))] = ID
	ID += 1
bit['-'] = ID
bit['_'] = ID + 1
for i in range(64):
	for j in range(64):
		mp[i & j] = mp.get(i & j, 0) + 1
for i in s:
	res = res * mp[bit[i]] % MOD
print(res)


s = input()
ans = 1
for x in s:
	if 48 <= ord(x) <= 57:
		now = int(x)
	elif 65 <= ord(x) <= 90:
		now = ord(x) - 55
	elif 97 <= ord(x) <= 122:
		now = ord(x) - 61
	elif x == '-':
		now = 62
	else:
		now = 63
	for i in range(6):
		if now & 2 ** i == 0:
			ans = ans * 3 % (10 ** 9 + 7)
print(ans)


chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
mp = {}
for i in range(len(chars)):
	mp[chars[i]] = i
zero = 0
s = input()
for i in range(len(s)):
	zero += sum([i == '0' for i in format(mp[s[i]], '06b')])
print(str(pow(3, zero, int(1000000000.0 + 7))))


s = input()
res = 1
for x in s:
	if 48 <= ord(x) <= 57:
		d = int(x)
	elif 65 <= ord(x) <= 90:
		d = ord(x) - 55
	elif 97 <= ord(x) <= 122:
		d = ord(x) - 61
	elif x == '-':
		d = 62
	else:
		d = 63
	for i in range(6):
		if d & 2 ** i == 0:
			res = res * 3 % 1000000007
print(res)


str_in = input()

def decode_char(c):
	if '0' <= c <= '9':
		return ord(c) - ord('0')
	elif 'A' <= c <= 'Z':
		return ord(c) - ord('A') + 10
	elif 'a' <= c <= 'z':
		return ord(c) - ord('a') + 36
	elif '-' == c:
		return 62
	elif '_' == c:
		return 63
	assert False
result_num = 0
for c in str_in:
	res_str = '{0:06b}'.format(decode_char(c))
	result_num += sum((1 for i in res_str if i == '0'))
print(pow(3, result_num, 10 ** 9 + 7))


word = input()
mod = 1000000007
res = 1
for i in word:
	if ord(i) >= 48 and ord(i) <= 57:
		i = ord(i) - 48
	elif ord(i) >= 65 and ord(i) <= 90:
		i = ord(i) - 55
	elif ord(i) >= 97 and ord(i) <= 122:
		i = ord(i) - 61
	elif ord(i) == 45:
		i = 62
	else:
		i = 63
	for j in range(6):
		if i >> j & 1 == 0:
			res = res * 3 % mod
print(res)


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
s = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
ID = {}
for i in range(len(s)):
	ID[s[i]] = i
ans = 0
M = 1000000007
s = input()
AND = 0
ans = 1
for i in s:
	AND = ID[i]
	c = 0
	while 2 ** c < 64:
		if AND & 1 == 0:
			ans = 3 * ans % M
		AND = AND >> 1
		c += 1
print(ans)


t = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
d = {x: 0 for x in t}
for i in range(64):
	for j in range(64):
		d[t[i & j]] += 1
s = input()
ss = 1
for i in s:
	ss *= d[i]
	ss %= 10 ** 9 + 7
print(ss)


def getLetterNumber(letter):
	if '0' <= letter <= '9':
		return ord(letter) - ord('0')
	if 'A' <= letter <= 'Z':
		return ord(letter) - ord('A') + 10
	if 'a' <= letter <= 'z':
		return ord(letter) - ord('a') + 36
	if letter == '-':
		return 62
	if letter == '_':
		return 63

def getNumberOfVairants(number):
	return 3 ** '{0:b}'.format(number).zfill(6).count('0')

def getNumber(str):
	result = 1
	for c in str:
		num = getLetterNumber(c)
		result = result * getNumberOfVairants(num)
		result %= int(1000000000.0) + 7
	return result
s = input()
print(getNumber(s))


modulo = 1000000007
saida = 1

def between(c, l, r):
	return ord(c) >= ord(l) and ord(c) <= ord(r)
entrada = input()
for elem in entrada:
	if between(elem, '0', '9'):
		elem = ord(elem) - ord('0')
	elif between(elem, 'A', 'Z'):
		elem = ord(elem) - ord('A') + 10
	elif between(elem, 'a', 'z'):
		elem = ord(elem) - ord('a') + 36
	elif elem == '-':
		elem = 62
	else:
		elem = 63
	for pos in range(6):
		if elem >> pos & 1 == 0:
			saida = saida * 3 % modulo
print(saida)


ans = 1
MOD = int(1000000000.0 + 7)
cnt = [0] * 64
for i in range(64):
	for j in range(64):
		cnt[i & j] += 1
s = input()
for i in s:
	if i >= '0' and i <= '9':
		ans *= cnt[ord(i) - ord('0')]
	elif i >= 'A' and i <= 'Z':
		ans *= cnt[ord(i) - ord('A') + 10]
	elif i >= 'a' and i <= 'z':
		ans *= cnt[ord(i) - ord('a') + 36]
	elif i == '-':
		ans *= cnt[62]
	ans %= MOD
print(ans)


c = 0
for l in input():
	if l.islower():
		v = ord(l) - 61
	elif l.isupper():
		v = ord(l) - 55
	elif l.isdigit():
		v = int(l)
	else:
		v = 62 if l == '-' else 63
	c += 6 - bin(v).count('1')
print(3 ** c % (7 + 10 ** 9))


A = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
Z = [0] * 64
for i in range(64):
	r = 0
	for j in range(64):
		for k in range(64):
			if i == j & k:
				r += 1
	Z[i] = r
r = 1
for c in input():
	r = r * Z[A.index(c)] % 1000000007
print(r)


from string import *
a = [0] * 64
for i in range(64):
	for j in range(64):
		a[i & j] += 1
x = 1
s = digits + ascii_uppercase + ascii_lowercase + '-_'
for y in input():
	x = x * a[s.index(y)] % 1000000007
print(x)


f = lambda x: 7 - len(bin(x)) + bin(x).count('0')
d = {str(i): f(i) for i in range(10)}
for i in range(65, 91):
	d[chr(i)] = f(i - 55)
for i in range(97, 123):
	d[chr(i)] = f(i - 61)
(d['_'], d['-'], s, m) = (0, 1, 1, 10 ** 9 + 7)
for i in input():
	s *= 3 ** d[i]
	s %= m
print(s)


import sys
import bisect
from math import ceil, floor, factorial

def c(a, b):
	return int(factorial(a) / (factorial(b) * factorial(a - b)))
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
mod = 10 ** 9 + 7
dic = {}
for i in range(0, 10):
	dic[chr(ord('0') + i)] = i
for i in range(10, 36):
	dic[chr(ord('A') + i - 10)] = i
for i in range(36, 62):
	dic[chr(ord('a') + i - 36)] = i
dic['-'] = 62
dic['_'] = 63
st = ri()
ans = 1
for i in range(len(st)):
	num = dic[st[i]]
	for i in range(0, 6):
		if num >> i & 1 == 0:
			ans = ans * 3 % mod
print(ans)


def intervalo(c, p, s):
	return ord(c) >= ord(p) and ord(c) <= ord(s)
s = input()
mod = 1000000007
saida = 1
for e in s:
	if intervalo(e, '0', '9'):
		e = ord(e) - ord('0')
	elif intervalo(e, 'a', 'z'):
		e = ord(e) - ord('a') + 36
	elif intervalo(e, 'A', 'Z'):
		e = ord(e) - ord('A') + 10
	elif e == '-':
		e = 62
	else:
		e = 63
	for i in range(6):
		if e >> i & 1 == 0:
			saida = 3 * saida % mod
print(saida)


from collections import defaultdict

def def_value():
	return 0
s = input()
series = []
and_count = defaultdict(def_value)
for i in range(64):
	for j in range(64):
		and_count[i & j] += 1
for c in s:
	if c in 'qwertyuioplkjhgfdsazxcvbnm':
		series.append(ord(c) - 61)
	elif c in 'QWERTYUIOPLKJHGFDSAZXCVBNM':
		series.append(ord(c) - 55)
	elif c in '0987654321':
		series.append(int(c))
	elif c == '-':
		series.append(62)
	else:
		series.append(63)
count = 1
mod = int(1000000000.0) + 7
for x in series:
	count = count * and_count[x] % mod
print(count)


alth = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
s = input()
ai = [729, 243, 243, 81, 243, 81, 81, 27, 243, 81, 81, 27, 81, 27, 27, 9, 243, 81, 81, 27, 81, 27, 27, 9, 81, 27, 27, 9, 27, 9, 9, 3, 243, 81, 81, 27, 81, 27, 27, 9, 81, 27, 27, 9, 27, 9, 9, 3, 81, 27, 27, 9, 27, 9, 9, 3, 27, 9, 9, 3, 9, 3, 3, 1]
ans = 1
for i in s:
	ans *= ai[alth.find(i)]
	ans %= 1000000007
print(ans)


table = []
for i in range(0, 64):
	ans = -1
	for z in bin(i):
		if z == '0':
			ans += 1
	table.append(ans + 8 - len(bin(i)))
s = input()
ans = 1
for i in s:
	if i == '_':
		z = 63
	elif i == '-':
		z = 62
	elif i.isdigit():
		z = int(i)
	elif ord(i) >= 97:
		z = ord(i) - 97 + 36
	else:
		z = ord(i) - 65 + 10
	ans *= 3 ** table[z]
	ans %= 10 ** 9 + 7
print(ans)


def count(num):
	string = bin(num)[2:]
	return string.count('0') + 6 - len(string)
key = [3 ** count(x) for x in range(64)]
dic = {}
for i in range(10):
	dic[chr(ord('0') + i)] = key[i]
for i in range(26):
	dic[chr(ord('A') + i)] = key[i + 10]
for i in range(26):
	dic[chr(ord('a') + i)] = key[i + 36]
dic['-'] = key[62]
dic['_'] = key[63]
mod = int(1000000000.0) + 7
string = input()
ans = 1
for x in string:
	ans = ans * dic[x] % mod
print(ans)


def esta_entre(c, l, r):
	return ord(l) <= ord(c) and ord(c) <= ord(r)
entrada = input()
result = 1
mod = 1000000007
for i in entrada:
	if esta_entre(i, '0', '9'):
		i = ord(i) - ord('0')
	elif esta_entre(i, 'A', 'Z'):
		i = ord(i) - ord('A') + 10
	elif esta_entre(i, 'a', 'z'):
		i = ord(i) - ord('a') + 36
	elif i == '-':
		i = 62
	elif i == '_':
		i = 63
	for j in range(6):
		if i >> j & 1 == 0:
			result = 3 * result % mod
print(result)


from collections import *
from math import floor, log2, ceil

def fill():
	(tem, ch) = (defaultdict(int, {str(i): i for i in range(10)}), ord('A'))
	for i in range(10, 36):
		tem[chr(ch)] = i
		ch += 1
	ch = ord('a')
	for i in range(36, 62):
		tem[chr(ch)] = i
		ch += 1
	(tem['-'], tem['_']) = (62, 63)
	return tem
(s, mem, ans) = (input(), fill(), 1)
for i in s:
	for j in range(6):
		if mem[i] & 1 << j == 0:
			ans = ans * 3 % 1000000007
print(ans)


import string
charset = string.digits + string.ascii_uppercase + string.ascii_lowercase + '-_'

def getValue(char):
	return charset.index(char)

def main():
	string = input()
	cnt = 1
	dict = {}
	for i in range(len(charset)):
		for j in range(i + 1, len(charset)):
			res = i & j
			if res in dict:
				dict[res] += 1
			else:
				dict[res] = 1
	for char in string:
		if getValue(char) in dict:
			cnt = cnt * (1 + 2 * dict[getValue(char)]) % 1000000007
	print(cnt)
main()


palavra = input()
num_de_pares = 0
for i in palavra:
	if i >= '0' and i <= '9':
		unicode = ord(i) - 48
		binario = bin(unicode)
		num_de_um = binario.count('1')
		num_de_pares += 6 - num_de_um
	if i >= 'A' and i <= 'Z':
		unicode = ord(i) - 55
		binario = bin(unicode)
		num_de_um = binario.count('1')
		num_de_pares += 6 - num_de_um
	if i >= 'a' and i <= 'z':
		unicode = ord(i) - 61
		binario = bin(unicode)
		num_de_um = binario.count('1')
		num_de_pares += 6 - num_de_um
	if i == '-':
		binario = bin(62)
		num_de_um = binario.count('1')
		num_de_pares += 6 - num_de_um
	if i == '_':
		binario = bin(63)
		num_de_um = binario.count('1')
		num_de_pares += 6 - num_de_um
print(3 ** num_de_pares % 1000000007)


zcount = [6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2, 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1, 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1, 4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0]
digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
s = input()
c = 0
for i in s:
	c += zcount[digits.index(i)]
k = 1
for j in range(c):
	k *= 3
	if k >= 1000000007:
		k = k % 1000000007
print(k % 1000000007)


from string import ascii_lowercase, ascii_uppercase, digits
MOD = 10 ** 9 + 7
BASE = digits + ascii_uppercase + ascii_lowercase + '-_'
s = input().rstrip()
a = [BASE.find(ch) for ch in s]
ret = 1
for val in a:
	ret *= 3 ** bin(val)[2:].zfill(6).count('0') % MOD
	ret %= MOD
print(ret)


print(3 ** sum((6 - bin({'-': 62, '_': 63}.get(c, ord(c) - 7 * (c > '9') - 6 * (c > 'Z') - 48)).count('1') for c in input())) % 1000000007)


t = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
d = {_: 0 for _ in t}
for a in range(64):
	for b in range(64):
		d[t[a & b]] += 1
ans = 1
for _ in input():
	ans = ans * d[_] % (10 ** 9 + 7)
print(ans)


from sys import stdin
result = 1
MD = 10 ** 9 + 7

def charToInt(c):
	assert len(c) == 1
	val = -1
	if c in '0123456789':
		val = int(c)
	elif c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
		val = ord(c) - 55
	elif c in 'abcdefghijklmnopqrstuvwxyz':
		val = ord(c) - 61
	elif c == '-':
		val = 62
	elif c == '_':
		val = 63
	return val

def solve(string):
	global result, MD
	for c in string:
		val = charToInt(c)
		binstring = bin(val)[2:]
		cnt = 0
		for c2 in binstring:
			if c2 == '1':
				cnt += 1
		num2 = 6 - cnt
		for x in range(num2):
			result = result * 3 % MD

def parse():
	global result
	line = input()
	solve(line)
	print(result)
	result = 1
parse()


def toi(c):
	if c >= '0' and c <= '9':
		return ord(c) - ord('0')
	if c >= 'A' and c <= 'Z':
		return ord(c) - ord('A') + 10
	if c >= 'a' and c <= 'z':
		return ord(c) - ord('a') + 36
	if c == '-':
		return 62
	if c == '_':
		return 63
s = input()
q = [0] * 64
for i in range(64):
	for j in range(64):
		q[i & j] += 1
r = 1
for c in s:
	r *= q[toi(c)]
	r %= 1000000007
print(r)


def main():

	def f1(c):
		x = ord(c)
		if ord('0') <= x <= ord('9'):
			res = int(c)
		elif ord('A') <= x <= ord('Z'):
			res = x - ord('A') + 10
		elif ord('a') <= x <= ord('z'):
			res = x - ord('a') + 36
		elif c == '-':
			res = 62
		elif c == '_':
			res = 63
		return res

	def f2(x):
		res = bin(x)[2:]
		res = '0' * (6 - len(res)) + res
		return res
	read = lambda : list(map(int, input().split()))
	s = input()
	mod = 10 ** 9 + 7
	n = len(s)
	a = [f2(f1(i)) for i in s]
	t = ''.join(a)
	p = t.count('0')
	ans = 3 ** p % mod
	print(ans)
main()


s = input()
mod = 10 ** 9 + 7
res = 1

def is_between(c, l, r):
	return ord(c) >= ord(l) and ord(c) <= ord(r)
for char in s:
	if is_between(char, '0', '9'):
		char = ord(char) - ord('0')
	elif is_between(char, 'A', 'Z'):
		char = ord(char) - ord('A') + 10
	elif is_between(char, 'a', 'z'):
		char = ord(char) - ord('a') + 36
	elif char == '-':
		char = 62
	else:
		char = 63
	for j in range(6):
		if char >> j & 1 == 0:
			res = 3 * res % mod
print(res)


import sys
read = lambda : sys.stdin.readline().strip()
readi = lambda : map(int, read().split())
from collections import *
import string
mapping = dict()
for key in string.digits:
	mapping[key] = int(key)
start = 10
for key in string.ascii_uppercase:
	mapping[key] = start
	start += 1
for key in string.ascii_lowercase:
	mapping[key] = start
	start += 1
mapping['-'] = 62
mapping['_'] = 63

def getCount(num):
	count = 0
	num = ~num
	for i in range(6):
		if num & 1 == 1:
			count += 1
		num = num >> 1
	return count
for key in mapping.keys():
	mapping[key] = getCount(mapping[key])
s = read()
ans = 1
mod = 10 ** 9 + 7
for key in s:
	ans = ans * 3 ** mapping[key] % mod
print(ans)


x = 10 ** 9 + 7
y = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
s = input()
count = 0
for i in s:
	b = bin(int(y.find(i)))[2:]
	count += b.zfill(6).count('0')
print(3 ** count % x)


def numZero(x):
	cnt = 0
	for i in range(6):
		if x & 1 << i == 0:
			cnt += 1
	return cnt
bits = list('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_')
nums = [i for i in range(64)]
dicts = dict(zip(bits, nums))
s = input()
total = 1
for c in s:
	t = dicts[c]
	zeros = numZero(t)
	total = total * 3 ** zeros % (10 ** 9 + 7)
print(total)


import string
MOD = 1000000007
s = input()
convertion = string.digits + string.ascii_uppercase + string.ascii_lowercase + '-_'
cnt = [0] * 64
for val in range(64):
	for x in range(64):
		for y in range(64):
			if x & y == val:
				cnt[val] += 1
ans = 1
for c in s:
	ans *= cnt[convertion.find(c)]
	ans %= MOD
print(ans)


import sys
import bisect
try:
	fin = open('in')
except:
	fin = sys.stdin
input = lambda : fin.readline().strip()
s = input()
r = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
t = sum((6 - bin(r.index(u)).count('1') for u in s))
ans = 1
mod = 10 ** 9 + 7
a = 3
while t:
	if t & 1:
		ans = ans * a % mod
	a = a * a % mod
	t >>= 1
print(ans)


ls = [0] * 100010
for i in range(64):
	for j in range(64):
		ls[i & j] += 1
s = input()
ss = 1
for i in s:
	if ord(i) >= ord('a') and ord(i) <= ord('z'):
		ss *= ls[ord(i) - ord('a') + 36]
	elif ord(i) >= ord('A') and ord(i) <= ord('Z'):
		ss *= ls[ord(i) - ord('A') + 10]
	elif ord(i) >= ord('0') and ord(i) <= ord('9'):
		ss *= ls[ord(i) - ord('0')]
	elif i == '-':
		ss *= ls[62]
	elif i == '_':
		ss *= ls[63]
	ss %= 10 ** 9 + 7
print(ss)


def conv(d):
	if '0' <= d <= '9':
		return int(d)
	if 'A' <= d <= 'Z':
		return 10 + ord(d) - ord('A')
	if 'a' <= d <= 'z':
		return 36 + ord(d) - ord('a')
	if d == '-':
		return 62
	return 63
cnt = [0] * 64
for a in range(64):
	for b in range(64):
		cnt[a & b] += 1
ans = 1
for d in input():
	ans = ans * cnt[conv(d)] % (10 ** 9 + 7)
print(ans)


cyph = [str(x) for x in range(10)] + [chr(65 + i) for i in range(26)] + [chr(97 + i) for i in range(26)] + ['-'] + ['_']
dct = {}

def decod(char):
	i = 0
	if char in dct:
		return dct[char]
	else:
		while cyph[i] != char:
			i += 1
		dct[char] = i
		return i
dct2 = {}

def zeros(i):
	if i in dct2:
		return dct2[i]
	else:
		cct = 0
		for j in range(6):
			cct += (i >> j) % 2
		dct2[i] = 6 - cct
		return dct2[i]
s = input()
cnt = 1
for char in s:
	tmp = decod(char)
	cnt *= 3 ** zeros(tmp)
	cnt %= 1000000007
print(cnt)


def rev(c):
	if c.isdigit():
		return ord(c) - ord('0')
	elif c.isupper():
		return 10 + ord(c) - ord('A')
	elif c.islower():
		return 36 + ord(c) - ord('a')
	elif c == '-':
		return 62
	else:
		return 63
counter = [0] * 64
for i in range(64):
	for j in range(64):
		counter[i & j] += 1
ans = 1
mod = int(1000000000.0 + 7)
for s in input():
	ans *= counter[rev(s)]
	ans %= mod
print(ans)


def get(s):
	try:
		return int(s)
	except:
		if s == '-':
			return 62
		elif s == '_':
			return 63
		elif s.isupper():
			return ord(s) - 55
		else:
			return ord(s) - 61
arr = [6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2, 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1, 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1, 4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0]
st = input()
count = 0
for i in range(len(st)):
	x = get(st[i])
	count += arr[x]
print(3 ** count % (10 ** 9 + 7))


def is_between(c, l, r):
	return ord(c) >= ord(l) and ord(c) <= ord(r)

def solve(letters, mod):
	result = 1
	for i in letters:
		if is_between(i, '0', '9'):
			i = ord(i) - ord('0')
		elif is_between(i, 'A', 'Z'):
			i = ord(i) - ord('A') + 10
		elif is_between(i, 'a', 'z'):
			i = ord(i) - ord('a') + 36
		elif i == '-':
			i = 62
		else:
			i = 63
		for j in range(6):
			if i >> j & 1 == 0:
				result = 3 * result % mod
	return result
mod = 1000000007
letters = input()
print(solve(letters, mod))


import string
MOD = 10 ** 9 + 7
digits = string.digits + string.ascii_uppercase + string.ascii_lowercase + '-_'
assert len(digits) == 64
zero_cnt = {k: '{:0>6b}'.format(i).count('0') for (i, k) in enumerate(digits)}
x = sum([zero_cnt[ch] for ch in input()])
print(3 ** x % MOD)


def sti(x):
	o = 0
	x = x[::-1]
	k = 1
	ans = 1
	for i in x:
		l = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
		o = l.index(i) * k
		for i in range(0, 6):
			if o & 2 ** i == 0:
				ans = ans * 3 % 1000000007
	return ans

def bth(x):
	x = x[::-1]
	k = 1
	o = 0
	for i in x:
		o += int(i) * k
		k *= 2
	return str(o)

def htb(x):
	x = int(x)
	s = ''
	while x > 0:
		s += str(x % 2)
		x //= 2
	return s[::-1]
s = input()
print(sti(s))