import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashMap;

public class a {
	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');
if (neg)
                return -ret;
            return ret;
        }
public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }
if (neg)
                return -ret;
            return ret;
        }
private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

	//User Defined Method start
	public static int inputInt()throws IOException
    {
        return sc.nextInt();
    }
    public static long inputLong()throws IOException
    {
        return sc.nextLong();
    }
    public static double inputDouble()throws IOException
    {
        return sc.nextDouble();
    }
    public static String inputString()throws IOException
    {
        return sc.readLine();
    }
    public static void print(String a)throws IOException
    {
        bw.write(a);
    }
    public static void printSp(String a)throws IOException
    {
        bw.write(a+" ");
    }
    public static void println(String a)throws IOException
    {
        bw.write(a+"\n");
    }
	//User Defined Method End

  //Helper Function - start
    private static void printArray(Integer arr[])
    {
    	for(int i:arr)
    		System.out.print(i+" ");
    	System.out.println();
    }

    private static void inputArray(int arr[]) throws IOException
    {
    	for(int i=0;i<arr.length;i++)
    	{
    		arr[i] = inputInt();
    	}
    }

    //helper Function - End

	//Defining input and output stream obj - Start
    static Reader sc=new Reader();
    static BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder s1 = new StringBuilder("");
    //Defining input and output stream obj - End
    static int mod = 1000000000+7;

	public static void main(String[] args) throws Exception{
		try{
		String s = inputString();
		s = s.trim();
		HashMap<Character,Integer> map = new HashMap<>();

		for(int i=0;i<10;i++)
			map.put((char)(i+'0'), i);
		for(int i=10;i<36;i++)
			map.put((char)('A'+i-10), i);
		for(int i=36;i<62;i++)
			map.put((char)('a'+i-36), i);
		map.put('-', 62);
		map.put('_', 63);

//		System.out.println(map);

		long ans = 1;
		for(int i=0;i<s.length();i++)
		{
			int x = map.get(s.charAt(i));
			for(int j=0;j<6;j++){
				if((x & (1<<j)) == 0)
					ans = (ans*3)%mod;
			}
		}

		System.out.println(ans);
		}catch(Exception e){
		    System.out.println(e);
		}
	}

}


import java.io.*;
import java.math.BigInteger;

/**
 * Created by Ольга on 23.05.2016.
 */

public class ProblemC {
  StreamTokenizer in;
  PrintWriter out;

  int N, H, K;
  int[] potatos;
  public static void main(String[] args) throws IOException {
    new ProblemC().run();
  }

  void run() throws IOException
  {
    in  = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    in.ordinaryChars('_', '_');
    in.ordinaryChars('-', '-');
    in.wordChars('_', '_');
    in.wordChars('-', '-');
    solve();
    out.flush();
  }

  private void solve() throws IOException{
    char[] chars = next().toCharArray();
    int[] charsNew = new int[chars.length];
    int ind = 0;
    for (char c:chars){
      if ('0' <= c && c <= '9')
        charsNew[ind++] = c - 48;
      else if ('A' <= c && c <= 'Z')
        charsNew[ind++] = c - 65 + 10;
      else if ('a' <= c && c <= 'z')
        charsNew[ind++] = c - 97 + 10 + 26;
      else if (c == '-')
        charsNew[ind++] = 62;
      else if (c == '_')
        charsNew[ind++] = 63;
    }

    int[] bitCount = new int[64];
    int count, num;
    for (int i=1;i<bitCount.length;i++){
      count = 0;
      num = i + 64;
      while (num > 0){
        if (num%2==0) count++;
        num/=2;
      }
      bitCount[i] = count;
    }
//    System.out.println(Arrays.toString(charsNew));
//    System.out.println(Arrays.toString(chars));

    int power = 0;
    for (int i=0;i<charsNew.length;i++){
//      System.out.println(charsNew[i]);
//      System.out.println(bitCount[charsNew[i]]);
      power += bitCount[charsNew[i]];
    }
    BigInteger bi = BigInteger.valueOf(3);
    bi = bi.pow(power).mod(BigInteger.valueOf(1000000007));
//    out.println(power);
    out.println(bi.toString());
  }

  int nextInt() throws IOException
  {
    in.nextToken();
    return (int)in.nval;
  }

  String next() throws IOException
  {
    in.nextToken();
    return in.sval;
  }
}


import java.io.*;
import java.math.BigInteger;
import java.util.Scanner;

/**
 * Created by Ольга on 23.05.2016.
 */

public class ProblemC {
  StreamTokenizer in;
  PrintWriter out;

  int N, H, K;
  int[] potatos;
  public static void main(String[] args) throws IOException {
    new ProblemC().run();
  }

  void run() throws IOException
  {
    in  = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    in.ordinaryChars('_', '_');
    in.ordinaryChars('-', '-');
    in.wordChars('_', '_');
    in.wordChars('-', '-');
    solve();
    out.flush();
  }

  private void solve() throws IOException{
    Scanner scanner = new Scanner(System.in);
    char[] chars = scanner.next().toCharArray();
    int[] charsNew = new int[chars.length];
    int ind = 0;
    for (char c:chars){
      if ('0' <= c && c <= '9')
        charsNew[ind++] = c - 48;
      else if ('A' <= c && c <= 'Z')
        charsNew[ind++] = c - 65 + 10;
      else if ('a' <= c && c <= 'z')
        charsNew[ind++] = c - 97 + 10 + 26;
      else if (c == '-')
        charsNew[ind++] = 62;
      else if (c == '_')
        charsNew[ind++] = 63;
    }

    int[] bitCount = new int[64];
    int count, num;
    for (int i=0;i<bitCount.length;i++){
      count = 0;
      num = i + 64;
      while (num > 0){
        if (num%2==0) count++;
        num/=2;
      }
      bitCount[i] = count;
    }
//    System.out.println(Arrays.toString(charsNew));
//    System.out.println(Arrays.toString(chars));
//    System.out.println(Arrays.toString(bitCount));

    int power = 0;
    for (int i=0;i<charsNew.length;i++){
//      System.out.println(charsNew[i]);
//      System.out.println(bitCount[charsNew[i]]);
      power += bitCount[charsNew[i]];
    }
    BigInteger bi = BigInteger.valueOf(3);
    bi = bi.pow(power).mod(BigInteger.valueOf(1000000007));
//    out.println(power);
    out.println(bi.toString());
  }

  int nextInt() throws IOException
  {
    in.nextToken();
    return (int)in.nval;
  }

  String next() throws IOException
  {
    in.nextToken();
    return in.sval;
  }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        String S = br.readLine();
        long ans = 1;
        HashMap<Integer, Integer> H = new HashMap<>();
        for(int t=0;t<64;t++){
            int cnt = 0;
            for(int i=0;i<64;i++){
                for(int j=0;j<64;j++){
                    if((i&j) == t) {
                        cnt+=1;
                    }
                }
            }
//            ans = 1L*ans*cnt;
//            ans %= 1000000007;
            H.put(t, cnt);
        }
        for(int t=0;t<S.length();t++){

                    int u = 0;
                    //is it s.t
                    char y = S.charAt(t);
                    if(y >= '0' && y<= '9'){
                        u = Integer.parseInt(Character.toString(y));
                    }else if(y>= 'A' && y<= 'Z') {
                        u = y-'A'+ 10;
                    }else if(y >= 'a' && y<= 'z') {
                        u = y-'a'+ 36;
                    }
                    else if(y=='_'){
                        u = 63;
                    }else{
                        u = 62;
                    }

                    int cnt = H.get(u);
                                ans = 1L*ans*cnt;
            ans %= 1000000007;
        }
        bw.append(ans+"\n");
        bw.close();

    }

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        String S = br.readLine();
        long ans = 1;
        for(int t=0;t<S.length();t++){
            int cnt = 0;
            for(int i=0;i<64;i++){
                for(int j=0;j<64;j++){
                    int x = i&j;
                    int u = 0;
                    //is it s.t
                    char y = S.charAt(t);
                    if(y >= '0' && y<= '9'){
                        u = Integer.parseInt(Character.toString(y));
                    }else if(y>= 'A' && y<= 'Z') {
                        u = y-'A'+ 10;
                    }else if(y >= 'a' && y<= 'z') {
                        u = y-'a'+ 36;
                    }
                    else if(y=='_'){
                        u = 63;
                    }else{
                        u = 62;
                    }

                    if(u==x)    {
                        cnt+=1;
                        //System.out.println(x+" anding");
                    }
                }
            }
            ans = 1L*ans*cnt;
            ans %= 1000000007;
        }
        bw.append(ans+"\n");
        bw.close();

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class C {

	static final int mod=1000000007;
	static long result(int zeros){
		long r=3L;
		while(zeros-->1){
			r*=3;
			r%=mod;
		}
		return r;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader bf= new BufferedReader(new InputStreamReader(System.in));
		int zeros=0;
		int num=0;
		String s= bf.readLine();
		int len= s.length();
		for(int i=0; i<len; i++){
			char c= s.charAt(i);
			if(c=='-')
				num=62;
			else if(c=='_')
				num=63;
			else if(c>='a' &&c<='z')
				num= 36+c-'a';
			else if(c>='A' && c<='Z')
				num=10+c-'A';
			else num= c-'0';

			for(int j=0; j<6; j++)
				if(((1<<j)& num)==0)
					zeros++;
		}
		if(zeros==0)
			System.out.println(1);
		else
			System.out.println(result(zeros));

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class C {

	static final int mod=1000000007;
	static long result(int zeros){
		long r=3L;
		while(zeros-->1){
			r*=3;
			r%=mod;
		}
		return r;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader bf= new BufferedReader(new InputStreamReader(System.in));
		int zeros=0;
		int num=0;
		String s= bf.readLine();
		int len= s.length();
		for(int i=0; i<len; i++){
			char c= s.charAt(i);
			if(c=='-')
				num=62;
			else if(c=='_')
				num=63;
			else if(c>='a' &&c<='z')
				num= 36+c-'a';
			else if(c>='A' && c<='Z')
				num=10+c-'A';
			else num= c-'0';

			for(int j=0; j<6; j++)
				if(((1<<j)& num)==0)
					zeros++;
		}
		System.out.println(result(zeros));

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class C {

	static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

	static char[] s;
	static int[] ss;
	static long ans=1;

	public static void main(String[] args) throws IOException {
		int[] aa = { 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 = next().toCharArray();
		ss=new int[s.length];
		for (int i = 0; i < s.length; i++) {
			if (s[i] >= '0' && s[i] <= '9')
				ss[i] = Integer.parseInt(String.valueOf(s[i]));
			else if (s[i] >= 'A' && s[i] <= 'Z')
				ss[i] = 10 + s[i] - 'A';
			else if (s[i] >= 'a' && s[i] <= 'z')
				ss[i] = 36 + s[i] - 'a';
			else if (s[i] == '-')
				ss[i] = 62;
			else if (s[i] == '_')
				ss[i] = 63;
			ans*=aa[ss[i]];
			if(ans>1e9+7)
				ans%=1000000007;
		}
		out.println(ans);
		out.flush();
	}

	static String next() throws IOException {
		in.nextToken();
		return in.sval;
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Scanner;

public class C {

	static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
	static Scanner sc = new Scanner(System.in);
	static char[] s;
	static int[] ss;
	static long ans = 1;

	public static void main(String[] args) throws IOException {
		int[] aa = { 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 = sc.next().toCharArray();
		ss = new int[s.length];
		for (int i = 0; i < s.length; i++) {
			if (s[i] >= '0' && s[i] <= '9')
				ss[i] = Integer.parseInt(String.valueOf(s[i]));
			else if (s[i] >= 'A' && s[i] <= 'Z')
				ss[i] = 10 + s[i] - 'A';
			else if (s[i] >= 'a' && s[i] <= 'z')
				ss[i] = 36 + s[i] - 'a';
			else if (s[i] == '-')
				ss[i] = 62;
			else if (s[i] == '_')
				ss[i] = 63;
			ans *= aa[ss[i]];
			if (ans > 1e9 + 7)
				ans %= 1000000007;
		}
		out.println(ans);
		out.flush();
	}

	static String next() throws IOException {
		in.nextToken();
		return in.sval;
	}

}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R355_Div2_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R355_Div2_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		String s = in.next();
		int n = s.length();
		String b64 = "";
		for (int i = 0; i <= 9; i++) b64 += i + "";
		for (char c = 'A'; c <= 'Z'; c++) b64 += c;
		for (char c = 'a'; c <= 'z'; c++) b64 += c;
		b64 += "-" + "_";

		int[] cnt = new int[64];
		for (int j = 0; j < 64; j++)
			for (int k = 0; k < 64; k++)
				cnt[(k & j)]++;

		long prod = 1;
		for (int i = 0; i < n; i++)
		{
			char c = s.charAt(i);
			int ind = b64.indexOf(c);
//			int cnt = 0;
//			for (int j = 0; j < 64; j++)
//				for (int k = 0; k < 64; k++)
//					if ((k & j) == ind) cnt++;

			prod *= cnt[ind];
			prod %= 1_000_000_007;
		}
		out.println(prod);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R355_Div2_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R355_Div2_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		String s = in.next();
		int n = s.length();
		String b64 = "";
		for (int i = 0; i <= 9; i++) b64 += i + "";
		for (char c = 'A'; c <= 'Z'; c++) b64 += c;
		for (char c = 'a'; c <= 'z'; c++) b64 += c;
		b64 += "-" + "_";

		HashMap<Character,Integer> hm = new HashMap<>();
		for (int i = 0; i < 64; i++)
		{
			char c = b64.charAt(i);
			hm.put(c,i);
		}

		int[] cnt = new int[64];
		for (int j = 0; j < 64; j++)
			for (int k = 0; k < 64; k++)
				cnt[(k & j)]++;

		long prod = 1;
		for (int i = 0; i < n; i++)
		{
			char c = s.charAt(i);
			int ind = hm.get(c);

//			int ind = b64.indexOf(c);
//			int cnt = 0;
//			for (int j = 0; j < 64; j++)
//				for (int k = 0; k < 64; k++)
//					if ((k & j) == ind) cnt++;

			prod *= cnt[ind];
			prod %= 1_000_000_007;
		}
		out.println(prod);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R355_Div2_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R355_Div2_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		String s = in.next();
		int n = s.length();
		String b64 = "";
		for (int i = 0; i <= 9; i++) b64 += i + "";
		for (char c = 'A'; c <= 'Z'; c++) b64 += c;
		for (char c = 'a'; c <= 'z'; c++) b64 += c;
		b64 += "-" + "_";

		long prod = 1;
		for (int i = 0; i < n; i++)
		{
			char c = s.charAt(i);
			int ind = b64.indexOf(c);
			int cnt = 0;
			for (int j = 0; j < 64; j++)
				for (int k = 0; k < 64; k++)
					if ((k & j) == ind) cnt++;

			prod *= cnt;
			prod %= 1_000_000_007;
		}
		out.println(prod);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R355_Div2_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R355_Div2_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		String s = in.next();
		int n = s.length();
		String b64 = "";
		for (int i = 0; i <= 9; i++) b64 += i + "";
		for (char c = 'A'; c <= 'Z'; c++) b64 += c;
		for (char c = 'a'; c <= 'z'; c++) b64 += c;
		b64 += "-" + "_";

//		HashMap<Character,Integer> hm = new HashMap<>();
//		for (int i = 0; i < 64; i++)
//		{
//			char c = b64.charAt(i);
//			hm.put(c,i);
//		}

		int[] cnt = new int[64];
		for (int j = 0; j < 64; j++)
			for (int k = 0; k < 64; k++)
				cnt[(k & j)]++;

		long prod = 1;
		for (int i = 0; i < n; i++)
		{
			char c = s.charAt(i);
			//int ind = hm.get(c);

			int ind = b64.indexOf(c);
//			int cnt = 0;
//			for (int j = 0; j < 64; j++)
//				for (int k = 0; k < 64; k++)
//					if ((k & j) == ind) cnt++;

			prod *= cnt[ind];
			prod %= 1_000_000_007;
		}
		out.println(prod);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.util.Scanner;

/**
 * Created by leen on 6/3/16.
 *
 * Codeforces
 */
public class MainC {

    static final long MOD = 1000000007;
    static long[] FACT = new long[1000001];
    static long[] POW = new long[1000001];

    static {
        FACT[0] = 1;
        for(int i = 1; i < FACT.length; i++)
            FACT[i] = (FACT[i - 1] * i) % MOD;

        POW[0] = 1;
        for(int i =1; i <POW.length; i++)
            POW[i] = (POW[i-1] << 1) % MOD;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            int numZeros = calcNumZeros(scan.next());
            long numPairs = 0;
            for(int m = 0; m <= numZeros; m++)
                numPairs = ((C(numZeros, m) * POW[numZeros - m]) % MOD + numPairs) % MOD;

            System.out.println(numPairs);
        }
    }

    static long fastPow(long base, long n) {
        if(n==0)
            return 1;
        if(n==1)
            return base;
        long halfn= fastPow(base, n / 2);
        if(n%2==0)
            return ( halfn * halfn ) % MOD;
        else
            return ( ( ( halfn * halfn ) % MOD ) * base ) % MOD;
    }

    static long findMMIFermat(long n) {
        return fastPow(n, MOD - 2);
    }

    static long C(int n, int m) {
        long numerator = FACT[n];
        long denominator = (FACT[m] * FACT[n-m]) % MOD;
        long mmi_denominator = findMMIFermat(denominator);
        return (numerator * mmi_denominator) % MOD;
    }

    static int calcNumZeros(String base64) {
        int numZeros = 0;
        for(int i = 0; i < base64.length(); i++) {
            char c = base64.charAt(i);

            int value;

            if(c == '-')
                value = 62;
            else if(c == '_')
                value = 63;
            else if(c >= 'a')
                value = (c - 'a') + 36;
            else if(c >= 'A')
                value = (c - 'A') + 10;
            else
                value = c - '0';

            for(int j = 0; j < 6; j++) {
                if((value & 0x1) == 0)
                    numZeros++;
                value >>= 1;
            }
        }
        return numZeros;
    }
}


import java.math.BigDecimal;
import java.util.Scanner;

/**
 * Created by leen on 6/3/16.
 *
 * Codeforces
 */
public class MainC {

    static final long MOD;

    static {
        long mod = 1;
        for(int i = 0; i < 9; i++)
            mod *= 10;
        mod += 7;
        MOD = mod;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            int numZeros = calcNumZeros(scan.next());
            long numPairs = 0;
            for(int m = 0; m <= numZeros; m++)
                numPairs = C(numZeros, m).multiply(new BigDecimal(2).pow(numZeros - m))
                        .add(new BigDecimal(numPairs)).remainder(new BigDecimal(MOD)).longValue();

            System.out.println(numPairs);
        }
    }

    static BigDecimal C(int n, int m) {
        if(m == 0)
            return new BigDecimal(1);
        BigDecimal result = new BigDecimal(1);
        for(int i = 0; i < m; i++)
            result = result.multiply(new BigDecimal(n - i));
        for(int j = 2; j <= m; j++)
            result = result.divide(new BigDecimal(j));
        return result;
    }

    static int calcNumZeros(String base64) {
        int numZeros = 0;
        for(int i = 0; i < base64.length(); i++) {
            char c = base64.charAt(i);

            int value;

            if(c == '-')
                value = 62;
            else if(c == '_')
                value = 63;
            else if(c >= 'a')
                value = (c - 'a') + 36;
            else if(c >= 'A')
                value = (c - 'A') + 10;
            else
                value = c - '0';

            for(int j = 0; j < 6; j++) {
                if((value & 0x1) == 0)
                    numZeros++;
                value >>= 1;
            }
        }
        return numZeros;
    }
}


import java.util.Scanner;

/**
 * Created by leen on 6/3/16.
 *
 * Codeforces
 */
public class MainC {

    static final long MOD = 1000000007;
    static long[] FACT = new long[1000001];
    static long[] POW = new long[1000001];

    static {
        FACT[0] = 1;
        for(int i = 1; i < FACT.length; i++)
            FACT[i] = (FACT[i - 1] * i) % MOD;

        POW[0] = 1;
        for(int i =1; i <POW.length; i++)
            POW[i] = (POW[i-1] << 1) % MOD;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            int numZeros = calcNumZeros(scan.next());
            long numPairs = 0;
            for(int m = 0; m <= numZeros / 2; m++) {
                long c = C(numZeros, m);
                numPairs = (( c * POW[numZeros - m]) % MOD + numPairs) % MOD;
                if(m != numZeros -m)
                    numPairs = (( c * POW[m]) % MOD + numPairs) % MOD;
            }

            System.out.println(numPairs);
        }
    }

    static long fastPow(long base, long n) {
        if(n==0)
            return 1;
        if(n==1)
            return base;
        long halfn= fastPow(base, n / 2);
        if(n%2==0)
            return ( halfn * halfn ) % MOD;
        else
            return ( ( ( halfn * halfn ) % MOD ) * base ) % MOD;
    }

    static long findMMIFermat(long n) {
        return fastPow(n, MOD - 2);
    }

    static long C(int n, int m) {
        long numerator = FACT[n];
        long denominator = (FACT[m] * FACT[n-m]) % MOD;
        long mmi_denominator = findMMIFermat(denominator);
        return (numerator * mmi_denominator) % MOD;
    }

    static int calcNumZeros(String base64) {
        int numZeros = 0;
        for(int i = 0; i < base64.length(); i++) {
            char c = base64.charAt(i);

            int value;

            if(c == '-')
                value = 62;
            else if(c == '_')
                value = 63;
            else if(c >= 'a')
                value = (c - 'a') + 36;
            else if(c >= 'A')
                value = (c - 'A') + 10;
            else
                value = c - '0';

            for(int j = 0; j < 6; j++) {
                if((value & 0x1) == 0)
                    numZeros++;
                value >>= 1;
            }
        }
        return numZeros;
    }
}


package leen.test.acm;

import java.math.BigDecimal;
import java.util.Scanner;

/**
 * Created by leen on 6/3/16.
 *
 * Codeforces
 */
public class PromblemC {

    static final long MOD;

    static {
        long mod = 1;
        for(int i = 0; i < 9; i++)
            mod *= 10;
        mod += 7;
        MOD = mod;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            int numZeros = calcNumZeros(scan.next());
            long numPairs = 0;
            for(int m = 0; m <= numZeros; m++)
                numPairs = C(numZeros, m).multiply(new BigDecimal(2).pow(numZeros - m))
                        .add(new BigDecimal(numPairs)).remainder(new BigDecimal(MOD)).longValue();

            System.out.println(numPairs);
        }
    }

    static BigDecimal C(int n, int m) {
        if(m == 0)
            return new BigDecimal(1);
        BigDecimal result = new BigDecimal(1);
        for(int i = 0; i < m; i++)
            result = result.multiply(new BigDecimal(n - i));
        for(int j = 2; j <= m; j++)
            result = result.divide(new BigDecimal(j));
        return result;
    }

    static int calcNumZeros(String base64) {
        int numZeros = 0;
        for(int i = 0; i < base64.length(); i++) {
            char c = base64.charAt(i);

            int value;

            if(c == '-')
                value = 62;
            else if(c == '_')
                value = 63;
            else if(c >= 'a')
                value = (c - 'a') + 36;
            else if(c >= 'A')
                value = (c - 'A') + 10;
            else
                value = c - '0';

            for(int j = 0; j < 6; j++) {
                if((value & 0x1) == 0)
                    numZeros++;
                value >>= 1;
            }
        }
        return numZeros;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class VanyaLabel {
    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in), 32768);
    static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String s = bf.readLine();

        final double MOD = 1E9 + 7;

        int[] m = new int[1000000];
        for(int i = 0; i <= 9; i++) m['0' + i] = i;
        for(int i = 0; i < 26; i++) m['A' + i] = 10 + i;
        for(int i = 0; i < 26; i++) m['a' + i] = 36 + i;
        m['-'] = 62; m['_'] = 63;
        long ans = 1;

        for(int i = 0; i < s.length(); i++) {
            for (int j = 0; j < 6; j++)
                if ((m[s.charAt(i)] & (1 << j)) == 0)
                    ans = (long) ((ans * 3) % MOD);
        }

        System.out.println(ans);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class VanyaLabel {
    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in), 32768);
    static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String s = bf.readLine();

        final double MOD = 1E9 + 7;

        int[] m = new int[1000000];
        for(int i = 0; i <= 9; i++) m['0' + i] = i;
        for(int i = 0; i < 26; i++) m['A' + i] = 10 + i;
        for(int i = 0; i < 26; i++) m['a' + i] = 36 + i;
        m['-'] = 62; m['_'] = 63;
        long ans = 1;

        for(int i = 0; i < s.length(); i++) {
            for (int j = 0; j < 6; j++)
                if ((m[s.charAt(i)] & (1 << j)) == 0)
                    ans = (long) ((ans * 3) % MOD);
        }

        System.out.println(ans == 1 ? 0 : ans);
    }
}


import java.util.*;
import java.io.*;

public class test {
public static void main(String args[]){
	InputReader in = new InputReader(System.in);
	String s = in.readString();
	int length = s.length();
	long count = 0;
	int 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};
	for(int i=0;i<length;i++){
		int temp =0;
		if(s.charAt(i)>=48&&s.charAt(i)<=57){
			temp = s.charAt(i)-48;
		}
		else if(s.charAt(i)>=65&&s.charAt(i)<=90){
			temp = s.charAt(i)-55;
		}
		else if(s.charAt(i)>=97&&s.charAt(i)<=122){
			temp = s.charAt(i)-61;
		}
		else if(s.charAt(i)=='_')
			temp = 63;
		else
			temp = 62;
		if(temp>32){
			count+=arr[temp-32]-1;
		}
		else
			count+=arr[temp];
	}
	System.out.println(expo(3,count)%1000000007);
}
public static long expo(long a, long b){
    if (b==1)
        return a%1000000007;
    if (b==2)
        return a*a%1000000007;

    if (b%2==0){
            return expo(expo(a,b/2%1000000007),2)%1000000007;
    }
    else{
        return a*expo(expo(a,(b-1)/2)%100000000,2)%1000000007;
    }
}
static class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[8192];
	private int curChar, snumChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int snext() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public String readString() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = snext();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
}


import java.util.*;
import java.io.*;

public class test {
public static void main(String args[]){
	InputReader in = new InputReader(System.in);
	String s = in.readString();
	int length = s.length();
	long count = 0;
	int 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};
	for(int i=0;i<length;i++){
		int temp =0;
		if(s.charAt(i)>=48&&s.charAt(i)<=57){
			temp = s.charAt(i)-48;
		}
		else if(s.charAt(i)>=65&&s.charAt(i)<=90){
			temp = s.charAt(i)-55;
		}
		else if(s.charAt(i)>=97&&s.charAt(i)<=122){
			temp = s.charAt(i)-61;
		}
		else if(s.charAt(i)=='_')
			temp = 63;
		else
			temp = 62;
		if(temp>32){
			count+=arr[temp-32]-1;
		}
		else
			count+=arr[temp];
	}
	System.out.println(expo(3,count));
}
public static long expo(long a, long b){
    if (b==1)
        return a%1000000007;
    if (b==2)
        return a*a%1000000007;

    if (b%2==0){
            return expo(expo(a,b/2),2)%1000000007;
    }
    else{
        return a*expo(expo(a,(b-1)/2),2)%1000000007;
    }
}
static class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[8192];
	private int curChar, snumChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int snext() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public String readString() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = snext();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
}


import java.util.*;
import java.io.*;

public class test {
public static void main(String args[]){
	InputReader in = new InputReader(System.in);
	String s = in.readString();
	int length = s.length();
	long count = 0;
	int 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};
	for(int i=0;i<length;i++){
		int temp =0;
		if(s.charAt(i)>=48&&s.charAt(i)<=57){
			temp = s.charAt(i)-48;
		}
		else if(s.charAt(i)>=65&&s.charAt(i)<=90){
			temp = s.charAt(i)-55;
		}
		else if(s.charAt(i)>=97&&s.charAt(i)<=122){
			temp = s.charAt(i)-61;
		}
		else if(s.charAt(i)=='_')
			temp = 63;
		else
			temp = 62;
		if(temp>32){
			count+=arr[temp-32]-1;
		}
		else
			count+=arr[temp];
	}
	if(count==0){
		System.out.println("1");
	}
	else
	System.out.println(expo(3,count)%1000000007);
}
public static long expo(long a, long b){
    if (b==1)
        return a%1000000007;
    if (b==2)
        return a*a%1000000007;

    if (b%2==0){
            return expo(expo(a,b/2)%1000000007,2)%1000000007;
    }
    else{
        return a*expo(expo(a,(b-1)/2)%1000000007,2)%1000000007;
    }
}
static class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[8192];
	private int curChar, snumChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int snext() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public String readString() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = snext();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
}


import java.util.*;
import java.io.*;

public class test {
public static void main(String args[]){
	InputReader in = new InputReader(System.in);
	String s = in.readString();
	int length = s.length();
	long count = 0;
	int 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};
	for(int i=0;i<length;i++){
		int temp =0;
		if(s.charAt(i)>=48&&s.charAt(i)<=57){
			temp = s.charAt(i)-48;
		}
		else if(s.charAt(i)>=65&&s.charAt(i)<=90){
			temp = s.charAt(i)-55;
		}
		else if(s.charAt(i)>=97&&s.charAt(i)<=122){
			temp = s.charAt(i)-61;
		}
		else if(s.charAt(i)=='_')
			temp = 63;
		else
			temp = 62;
		if(temp>32){
			count+=arr[temp-32]-1;
		}
		else
			count+=arr[temp];
	}
	System.out.println(expo(3,count)%1000000007);
}
public static long expo(long a, long b){
    if (b==1)
        return a%1000000007;
    if (b==2)
        return a*a%1000000007;

    if (b%2==0){
            return expo(expo(a,b/2)%1000000007,2)%1000000007;
    }
    else{
        return a*expo(expo(a,(b-1)/2)%1000000007,2)%1000000007;
    }
}
static class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[8192];
	private int curChar, snumChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int snext() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public String readString() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = snext();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
}


// package Mathematical;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class VanyaAndLabel {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        HashMap<Character,Integer> map=new HashMap<>();
        for(int i=48;i<=57;i++){
            map.put((char)i,i-48);
        }
        for(int i=65;i<=90;i++){
            map.put((char)i,i-65+10);
        }
        for(int i=97;i<=122;i++){
            map.put((char)i,i-97+36);
        }
        map.put('_',63);
        map.put('-',62);
//        System.out.println(map.toString());
        HashMap<Character,Integer> count=new HashMap<>();
        for(char key:map.keySet()){
            int val=map.get(key);
            int c=0;
            for(int i=0;i<=63;i++){
                for(int j=0;j<=63;j++){
                    int temp=i&j;
                    if(temp==val){
                        c++;
                    }
                }
            }
            count.put(key,c);
        }
        int mod=1000000007;
        long ans=1;
        String str=br.readLine();
        for(int i=0;i<str.length();i++){
            char c=str.charAt(i);
            int val=count.get(c);
            ans=(ans*val)%mod;
        }
        System.out.println(ans);
    }
}


import java.util.*;

public class MyClass {
    public static void main(String args[]) {
        Scanner scan=new Scanner(System.in);
        int bits=0;
        char[] a=scan.next().toCharArray();
        for(int i=0;i<a.length;i++) {
            char c=a[i];
            if(c>='0'&&c<='9') {
                bits+=Integer.bitCount((int)(c-'0'));
            }
            if(c>='A'&&c<='Z') {
                bits+=Integer.bitCount((int)(c-'A')+10);
            }
            if(c>='a'&&c<='z') {
                bits+=Integer.bitCount((int)(c-'a')+36);
            }
            if(c=='-') {
                bits+=Integer.bitCount(62);
            }
            if(c=='_') {
                bits+=Integer.bitCount(63);
            }
        }
        int totalbits=a.length*6;
        long res=1L;
        for(int i=0;i<totalbits-bits;i++) res=(res*3)%1000000007;
        System.out.println(res);
    }
}


import java.util.Scanner;

public class A {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		String a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
		long mod = 1000000007;
	    long a1[] = new long[64];
	    long cnt = 1 , j = 0 ;
		int i = 0;
	    String r = in.next();
	    for(i=0;i<64;i++)
	    	for(j=0;j<64;j++)
	    		a1[(int) (i&j)]++;
	    for(i=0;i<r.length();)
	    	cnt = cnt * a1 [ cnt(r.charAt(i++)) ]%mod;
	    System.out.println(cnt);
	}
	static int cnt(char t){
		int s=(int)t;
		return s==95?63:s==45?62:s>96?s-61:s>64?s-55:s-48;
	}

}


import javax.accessibility.AccessibleRole;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class TaskE implements Runnable {
    PrintWriter w;
    InputReader c;
    long mod = (int)1e9 + 7;
    public void run() {
        c = new InputReader(System.in);
        w = new PrintWriter(System.out);

        char s[] = c.next().toCharArray();
        int n = s.length;
        long res_multiply[] = new long[n];

        HashMap<Character, Integer> m = new HashMap<>();
        for(int i=0;i<26;i++)
            m.put((char)('A' + i), 10 + i);
        for(int i=0;i<26;i++)
            m.put((char)('a' + i), 36 + i);
        m.put('-',62); m.put('_',63);
        for(int i=0;i<=9;i++)
            m.put((char)('0'+i),0+i);

        for(int i=0;i<n;i++){
            int num = m.get(s[i]);
            int zeroes = 0;
            for(int j=0;j<6;j++,num>>=1){
                if((num&1) == 0) zeroes++;
            }

            long temp = 0;
            for(int j=0;j<=zeroes;j++){
                temp += (long)pow(2,zeroes-j) * nCr(zeroes,j);
            }
            res_multiply[i] = temp;
        }

        long ans = 1;
        for(int i=0;i<n;i++) {
            ans *= res_multiply[i] % mod;
            ans %= mod;
        }
        w.println(ans);

        w.close();
    }
    int nCr(int n, int r)
    {
        return fact(n) / (fact(r) * fact(n - r));
    }
    int fact(int n)
    {
        int res = 1;
        for (int i = 2; i <= n; i++)
            res = res * i;
        return res;
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        return f;
    }
    public void printArray(int[] a){
        for(int i=0;i<a.length;i++)
            w.print(a[i]+" ");
        w.println();
    }
    public int[] scanArrayI(int n){
        int a[] = new int[n];
        for(int i=0;i<n;i++)
            a[i] = c.nextInt();
        return a;
    }
    public long[] scanArrayL(int n){
        long a[] = new long[n];
        for(int i=0;i<n;i++)
            a[i] = c.nextLong();
        return a;
    }
    public void printArray(long[] a){
        for(int i=0;i<a.length;i++)
            w.print(a[i]+" ");
        w.println();
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    long power(long x, long y, long p){
        long res = 1;
        x = x % p;
        while (y > 0)
        {
            if((y & 1)==1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new TaskE(),"TaskE",1<<26).start();
    }
}


import javax.accessibility.AccessibleRole;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class TaskE implements Runnable {
    PrintWriter w;
    InputReader c;
    long mod = (int)1e9 + 7;
    public void run() {
        c = new InputReader(System.in);
        w = new PrintWriter(System.out);

        char s[] = c.next().toCharArray();
        int n = s.length;
        long res_multiply[] = new long[n];

        HashMap<Character, Integer> m = new HashMap<>();
        for(int i=0;i<26;i++)
            m.put((char)('A' + i), 10 + i);
        for(int i=0;i<26;i++)
            m.put((char)('a' + i), 36 + i);
        m.put('-',62); m.put('_',63);

        for(int i=0;i<n;i++){
            int num = m.get(s[i]);
            int zeroes = 0;
            for(int j=0;j<6;j++,num>>=1){
                if((num&1) == 0) zeroes++;
            }

            long temp = 0;
            for(int j=0;j<=zeroes;j++){
                temp += (long)pow(2,zeroes-j) * nCr(zeroes,j);
            }
            res_multiply[i] = temp;
        }

        long ans = 1;
        for(int i=0;i<n;i++) {
            ans *= res_multiply[i] % mod;
            ans %= mod;
        }
        w.println(ans);

        w.close();
    }
    int nCr(int n, int r)
    {
        return fact(n) / (fact(r) * fact(n - r));
    }
    int fact(int n)
    {
        int res = 1;
        for (int i = 2; i <= n; i++)
            res = res * i;
        return res;
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        return f;
    }
    public void printArray(int[] a){
        for(int i=0;i<a.length;i++)
            w.print(a[i]+" ");
        w.println();
    }
    public int[] scanArrayI(int n){
        int a[] = new int[n];
        for(int i=0;i<n;i++)
            a[i] = c.nextInt();
        return a;
    }
    public long[] scanArrayL(int n){
        long a[] = new long[n];
        for(int i=0;i<n;i++)
            a[i] = c.nextLong();
        return a;
    }
    public void printArray(long[] a){
        for(int i=0;i<a.length;i++)
            w.print(a[i]+" ");
        w.println();
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    long power(long x, long y, long p){
        long res = 1;
        x = x % p;
        while (y > 0)
        {
            if((y & 1)==1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new TaskE(),"TaskE",1<<26).start();
    }
}


import java.io.*;
import java.util.*;

public class C
{

	FastScanner in;
	PrintWriter out;
	int i = 0, j = 0;

	void solve() {
		/**************START**************/
		char[] s = in.next().toCharArray();
		long total = 1;
		long mod = 1000000007L;
		long cur = 0;
		for (i = 0; i < s.length; i++)
		{
			cur = getSol(s[i]);
			total *= cur;
			total %= mod;
		}
		out.println(total);

		/***************END***************/
	}

	public long getSol(char c)
	{
		int num = 0;
		if (c >= '0' && c <= '9')
		{
			num = (int)(c - '0');
		}
		else if (c >= 'A' && c <= 'Z')
		{
			num = 10 + (int)(c - 'A');
		}
		else if (c >= 'a' && c <= 'z')
		{
			num = 36 + (int)(c - 'a');
		}
		else if (c == '-')
		{
			num = 62;
		}
		else
		{
			return 1;
		}
		int zeros = 6 - Integer.bitCount(num);
		long sol = (long)Math.pow(3, zeros);
		return sol;
	}

	public static void main(String[] args) {
		new C().runIO();
	}

	void runIO() {
		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


import java.util.*;
import java.io.*;
import java.lang.Math.*;

public class Main{
	public static void main(String args[]){
		PrintWriter out=new PrintWriter(System.out);
		InputReader in=new InputReader(System.in);

		int comb[]=new int[64];
		for(int i=0;i<64;i++){
			for(int j=0;j<64;j++){
				int and = (i&j);
				if(and <64){
					comb[and]++;
				}
			}
		}
		String s = in.next();
		long mod = (int)1e9+7;
		long ans = 1;
		int len = s.length();

		for(int i=0;i<len;i++){
			int charAt = (int)s.charAt(i);
			if(charAt == '-'){
				charAt = 62;
			}
			else if(charAt =='_'){
				charAt = 63;
			}
			else if(charAt>=97){
				charAt= charAt - 97 +36;
			}
			else if(charAt>=65){
				charAt -= 65-10;
			}
			else{
				charAt -= 48;
			}

			ans = (ans*comb[charAt])%mod;
		}
		out.println(ans);
		out.close();
	}
	static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


#include<bits/stdc++.h>
using namespace std;

#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
#define endl "\n"
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl
#define bug(n) {outl(n);return;}
#define N 200005
ll n,a[N],m[2][N],v[N][2],dp[N][2],ans[N],f,c;
map<ll,set<pll> > C;
ll dfs(ll i, ll k){
	if(i==0||i==n+1||f)return 0;
	if(v[i][k]==c||(i==1&&k==1)){
		f=1;
		return 0;
	}
	if(v[i][k])return dp[i][k];
	v[i][k]=c;
	C[c].insert({i,k});
	dp[i][k]=a[i];
	dp[i][k]+=dfs(m[k][i],k^1);
	return dp[i][k];
}
void solve(){
	cin>>n;
	rep(i,2,n+1)cin>>a[i];
	rep(i,2,n+1){
		m[1][i]=min(n+1,i+a[i]);
		m[0][i]=max(0ll,i-a[i]);
	}
	v[1][1]=c=1;
	rep(i,2,n+1){
		if(!v[i][0]){
			f=0;
			c++;
			dfs(i,0);
			if(f){
				for(auto i:C[c])dp[i.fi][i.se]=-1;
			}
		}
		if(!v[i][1]){
			f=0;
			c++;
			dfs(i,1);
			if(f){
				for(auto i:C[c])dp[i.fi][i.se]=-1;
			}
		}
	}
	rep(i,1,n){
		a[1]++;
		if(dp[1+a[1]][0]!=-1)outl(dp[1+a[1]][0]+a[1]);
		else outl(-1);
	}
}
void prep(){

}
int main(){
    io;
    ll t=1;
    // cin>>t;
    prep();
    fix(12);
    while(t--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define in ({ll x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;})

#define ll long long
#define FOR(i,a,b) for(int i(a);i<=b;i++)
#define ROF(i,a,b) for(int i(b);a<=i;i--)
#define rr(x) " "<<#x<<'='<<x<<" "

#define bit(x,i) ((x>>(i-1))&1ll)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1ll<<(i-1)))
#define pow2(x) (1ll<<x)

#define mt make_tuple
#define pi pair<int,ll>
#define x first
#define y second

#define VEC(i,a) for(auto&i:a)
#define pb push_back
#define allv(a) a.begin(),a.end()
#define endv(a) (int)a.size()-1
////////////////////////////////////////////// NIRO
const int N=2e5+5;
int n;
ll a[N],d[N][2],p[N][2];
pi s[N][2];

void GET(int x,int o)
{
    if(p[x][o]) return;p[x][o]=true;
    s[x][o]={0,a[x]};

    int des=x+(o?a[x]:-a[x]);
    int odes=1-o;

    if(des<1||n<des) s[x][o].x=0;
    else if(d[des][odes]) s[x][o].x=1;
    else if(des==1)
    {
        if(odes==0) s[x][o].x=0;
        else if(odes==1) s[x][o].x=1;
    }
    else
    {
        d[x][o]=1;
        GET(des,odes);
        d[x][o]=0;

        if(s[des][odes].x==0) s[x][o].y+=s[des][odes].y;
        else s[x][o].x=s[des][odes].x;
    }
}
main()
{
    //freopen("nr.inp","r",stdin);
    n=in;
    FOR(i,2,n) a[i]=in;

    FOR(i,2,n) GET(i,0),GET(i,1);

   /* FOR(i,2,n) FOR(o,0,1)
    {
        cout<<rr(i) rr(o) rr(s[i][o].x) rr(s[i][o].y) "\n";
    }*/

    //cout<<"=============\n";
    FOR(i,1,n-1)
    {
        a[1]=i;p[1][1]=false;
        GET(1,1);

        if(s[1][1].x==0) cout<<s[1][1].y;
        else cout<<-1;
        cout<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;

#define in ({ll x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;})

#define ll long long
#define FOR(i,a,b) for(int i(a);i<=b;i++)
#define ROF(i,a,b) for(int i(b);a<=i;i--)
#define rr(x) " "<<#x<<'='<<x<<" "

#define bit(x,i) ((x>>(i-1))&1ll)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1ll<<(i-1)))
#define pow2(x) (1ll<<x)

#define mt make_tuple
#define pi pair<int,ll>
#define x first
#define y second

#define VEC(i,a) for(auto&i:a)
#define pb push_back
#define allv(a) a.begin(),a.end()
#define endv(a) (int)a.size()-1
////////////////////////////////////////////// NIRO
const int N=2e5+5;
int n;
ll a[N],d[N][2],p[N][2];
pi s[N][2];

void GET(int x,int o)
{
    if(p[x][o]) return;p[x][o]=true;
    s[x][o].y=a[x];

    int des=x+(o?a[x]:-a[x]);
    int odes=1-o;

    if(des<1||n<des) s[x][o].x=0;
    else if(d[des][odes]) s[x][o].x=1;
    else if(des==1)
    {
        if(odes==0) s[x][o].x=0;
        else if(odes==1) s[x][o].x=1;
    }
    else
    {
        d[x][o]=1;
        GET(des,odes);
        d[x][o]=0;

        if(s[des][odes].x==0) s[x][o].y+=s[des][odes].y;
        else s[x][o].x=s[des][odes].x;
    }
}
main()
{
    //freopen("nr.inp","r",stdin);
    n=in;
    FOR(i,2,n) a[i]=in;

    FOR(i,2,n) GET(i,0),GET(i,1);

    /*FOR(i,2,n) FOR(o,0,1)
    {
        cout<<rr(i) rr(o) rr(s[i][o].x) rr(s[i][o].y) "\n";
    }*/

    FOR(i,1,n-1)
    {
        a[1]=i;p[1][1]=false;
        GET(1,1);

        if(s[1][1].x==0) cout<<s[1][1].y;
        else cout<<-1;
        cout<<"\n";
    }
}


#include <stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#include <algorithm>
#define N 200005
#define mod 1000000009

#define C(x) memset(x, -1, sizeof(x))
#define go(i,n,m) for(int i=n; i<=m; i++)
#define down(i,n,m) for(int i=n; i>=m; i--)

using namespace std;

typedef long long ll;
void gt(int &a, int b){ if (a < b) a = b; }
string n2s(int a){ stringstream ss; ss << a; return ss.str(); }

/**
Use cases & Constrains
    integers x, y, sequence a1, a2, ... an
    Operations
        1. x = 1, y = 0, if x<=0, x>n terminate
        2. Increase x, y by ax
        3. Increase y by ax, decrease x by ax
        4. Step 2 and 3 repeat until it terminate (it may never terminate)

    a2, a3, ... an
    each i:1->n-1 we apply on sequence i, a2, a3, ..., an
        ternimate -> value of y
        not terminate -> -1

    Input
        n, a2,... an
        n: 2->200000, ai: 1 -> 10^9
    Output
        n-1 line value of y

Ideas:
    Termination condition
        x<=0 || x>n
    First idea -> brute force
        Each i:1->n-1 we have sequence a1, a2 .. an, process it

        Process sequence a1, a2, ... an
            map
            Each combination step 2, step 3 we
                if(map[x]) terminate
                map[x]
                    y+=a[x], x+=a[x] check termination
                    y+=a[x], x-=a[x] check termination

        Complexity O(n^2)

    Second idea:
        Some patterns
            input u
                if process step[2], + a[u]
                process step(2,3) + a[u] + a[u+a[u]]
            each u ->(v, w)

        Directed Graph
            Each node
                Have index u, u:1->n
                Adjacen c
                    v -> u (by step 2 + 3)
                edges[u] list of edge
                                    from, to , w
                u>=2 -> v is uniqe

            Result d[x]
                + u , after (step 23) value <=0 or >n => d[u] = w;
                + for each u we apply dfs calculate d[x]
                    d[e.to] = d[e.from] + e.w;
                + Other cout -1

    Sudo
        d[N]{-1}
        For u:2->n we compute v and w by step 1 and step 2
            if v valid
                g[v].push({v,u,w})
                else d[u] = w; end[u] = 1;

        u: 2->n
            if end[u] dfs(u)

        u:1->n-1
            u -> v ,w
            if(d[v] == -1) cout -1
            else cout d[v] + w
    Test
        4 : 2 4 1
        u = 2   v = -1. y = 6;
            end point, d[2] = 6;
        u = 3  v = 7, y=4
            d[3] = 4;
        u=4, v=5 endpoint
            d[4] = 1;

        a[1] = 1, d[1] = 0 cout 3
        a[1] = 2, next -1 cout 6
        a[1] = 3, next 3, w=4 , ans w+d[w] = 8
 Sample
    4 : 2 4 1
    1 2 4 1
        x: 1 -> 2 -> 0, y =3
    2 2 4 1
        x: 1 -> 3 -> -1, y=6
    3 2 4 1
        x: 1 -> 4 -> 3 -> 7 => y = 8
 */

struct Edge{
    int from;
    int to;
    int w;
};

int n, a[N], endPoint[N]{0};
ll d[N];
vector<Edge> edges[N];

pair<int, int> getNext(int x){
    int w = a[x];
    x = x+a[x];
    if(x<=0 || x>n) return {x, w};
    return {x-a[x], w+a[x]};
}

void dfs(int u){
    for (auto e:edges[u]){
        d[e.to] = d[e.from] + e.w;
        dfs(e.to);
    }
}

int main() {
//    ifstream in;
//    in.open("/Users/Tom/Program/algo/programming_challenge/data/input.txt");
//    std::cin.rdbuf(in.rdbuf()); //redirect std::cin to in.txt!

    cin >> n;
    go(i,2,n) cin >> a[i];
    memset(d, -1, sizeof(d));
    go(u,2,n){
        auto p = getNext(u);
        int v=p.first, w = p.second;
        if (v <= 0 || v>n){
            d[u] = w;
            endPoint[u] = 1;
        } else {
            edges[v].push_back({v,u,w});
        }
    }
    go(u,2,n) if (endPoint[u]) dfs(u);

    go(i,1,n-1){
        a[1] = i;
        auto p = getNext(1);
        int v=p.first, w = p.second;
        if(v<=0 || v>n) cout << w << endl;
        else if(v==1 || d[v] == -1) cout << -1 << endl;
        else cout << d[v] + w;
    }
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#include <algorithm>
#define N 200005
#define mod 1000000009

#define C(x) memset(x, -1, sizeof(x))
#define go(i,n,m) for(int i=n; i<=m; i++)
#define down(i,n,m) for(int i=n; i>=m; i--)

using namespace std;

typedef long long ll;
void gt(int &a, int b){ if (a < b) a = b; }
string n2s(int a){ stringstream ss; ss << a; return ss.str(); }

/**
Use cases & Constrains
    integers x, y, sequence a1, a2, ... an
    Operations
        1. x = 1, y = 0, if x<=0, x>n terminate
        2. Increase x, y by ax
        3. Increase y by ax, decrease x by ax
        4. Step 2 and 3 repeat until it terminate (it may never terminate)

    a2, a3, ... an
    each i:1->n-1 we apply on sequence i, a2, a3, ..., an
        ternimate -> value of y
        not terminate -> -1

    Input
        n, a2,... an
        n: 2->200000, ai: 1 -> 10^9
    Output
        n-1 line value of y

Ideas:
    Termination condition
        x<=0 || x>n
    First idea -> brute force
        Each i:1->n-1 we have sequence a1, a2 .. an, process it

        Process sequence a1, a2, ... an
            map
            Each combination step 2, step 3 we
                if(map[x]) terminate
                map[x]
                    y+=a[x], x+=a[x] check termination
                    y+=a[x], x-=a[x] check termination

        Complexity O(n^2)

    Second idea:
        Some patterns
            input u
                if process step[2], + a[u]
                process step(2,3) + a[u] + a[u+a[u]]
            each u ->(v, w)

        Directed Graph
            Each node
                Have index u, u:1->n
                Adjacen c
                    v -> u (by step 2 + 3)
                edges[u] list of edge
                                    from, to , w
                u>=2 -> v is uniqe

            Result d[x]
                + u , after (step 23) value <=0 or >n => d[u] = w;
                + for each u we apply dfs calculate d[x]
                    d[e.to] = d[e.from] + e.w;
                + Other cout -1

    Sudo
        d[N]{-1}
        For u:2->n we compute v and w by step 1 and step 2
            if v valid
                g[v].push({v,u,w})
                else d[u] = w; end[u] = 1;

        u: 2->n
            if end[u] dfs(u)

        u:1->n-1
            u -> v ,w
            if(d[v] == -1) cout -1
            else cout d[v] + w
    Test
        4 : 2 4 1
        u = 2   v = -1. y = 6;
            end point, d[2] = 6;
        u = 3  v = 7, y=4
            d[3] = 4;
        u=4, v=5 endpoint
            d[4] = 1;

        a[1] = 1, d[1] = 0 cout 3
        a[1] = 2, next -1 cout 6
        a[1] = 3, next 3, w=4 , ans w+d[w] = 8
 Sample
    4 : 2 4 1
    1 2 4 1
        x: 1 -> 2 -> 0, y =3
    2 2 4 1
        x: 1 -> 3 -> -1, y=6
    3 2 4 1
        x: 1 -> 4 -> 3 -> 7 => y = 8
 */

struct Edge{
    int from;
    int to;
    int w;
};

int n, a[N], endPoint[N]{0};
ll d[N];
vector<Edge> edges[N];

pair<int, int> getNext(int x){
    int w = a[x];
    x = x+a[x];
    if(x<=0 || x>n) return {x, w};
    return {x-a[x], w+a[x]};
}

void dfs(int u){
    for (auto e:edges[u]){
        d[e.to] = d[e.from] + e.w;
        dfs(e.to);
    }
}

int main() {
//    ifstream in;
//    in.open("/Users/Tom/Program/algo/programming_challenge/data/input.txt");
//    std::cin.rdbuf(in.rdbuf()); //redirect std::cin to in.txt!

    cin >> n;
    go(i,2,n) cin >> a[i];
    memset(d, sizeof(d), -1);
    go(u,2,n){
        auto p = getNext(u);
        int v=p.first, w = p.second;
        if (v <= 0 || v>n){
            d[u] = w;
            endPoint[u] = 1;
        } else {
            edges[v].push_back({v,u,w});
        }
    }
    go(u,2,n) if (endPoint[u]) dfs(u);

    go(i,1,n-1){
        a[1] = i;
        auto p = getNext(1);
        int v=p.first, w = p.second;
        if(v<=0 || v>n) cout << w << endl;
        else if(v==1 || d[v] == -1) cout << -1 << endl;
        else cout << d[v] + w;
    }
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#include <algorithm>
#define N 200005
#define mod 1000000009

#define C(x) memset(x, -1, sizeof(x))
#define go(i,n,m) for(int i=n; i<=m; i++)
#define down(i,n,m) for(int i=n; i>=m; i--)

using namespace std;

typedef long long ll;
void gt(int &a, int b){ if (a < b) a = b; }
string n2s(int a){ stringstream ss; ss << a; return ss.str(); }

/**
Use cases & Constrains
    integers x, y, sequence a1, a2, ... an
    Operations
        1. x = 1, y = 0, if x<=0, x>n terminate
        2. Increase x, y by ax
        3. Increase y by ax, decrease x by ax
        4. Step 2 and 3 repeat until it terminate (it may never terminate)

    a2, a3, ... an
    each i:1->n-1 we apply on sequence i, a2, a3, ..., an
        ternimate -> value of y
        not terminate -> -1

    Input
        n, a2,... an
        n: 2->200000, ai: 1 -> 10^9
    Output
        n-1 line value of y

Ideas:
    Termination condition
        x<=0 || x>n
    First idea -> brute force
        Each i:1->n-1 we have sequence a1, a2 .. an, process it

        Process sequence a1, a2, ... an
            map
            Each combination step 2, step 3 we
                if(map[x]) terminate
                map[x]
                    y+=a[x], x+=a[x] check termination
                    y+=a[x], x-=a[x] check termination

        Complexity O(n^2)

    Second idea:
        Some patterns
            input u
                if process step[2], + a[u]
                process step(2,3) + a[u] + a[u+a[u]]
            each u ->(v, w)

        Directed Graph
            Each node
                Have index u, u:1->n
                Adjacen c
                    v -> u (by step 2 + 3)
                edges[u] list of edge
                                    from, to , w
                u>=2 -> v is uniqe

            Result d[x]
                + u , after (step 23) value <=0 or >n => d[u] = w;
                + for each u we apply dfs calculate d[x]
                    d[e.to] = d[e.from] + e.w;
                + Other cout -1

    Sudo
        d[N]{-1}
        For u:2->n we compute v and w by step 1 and step 2
            if v valid
                g[v].push({v,u,w})
                else d[u] = w; end[u] = 1;

        u: 2->n
            if end[u] dfs(u)

        u:1->n-1
            u -> v ,w
            if(d[v] == -1) cout -1
            else cout d[v] + w
    Test
        4 : 2 4 1
        u = 2   v = -1. y = 6;
            end point, d[2] = 6;
        u = 3  v = 7, y=4
            d[3] = 4;
        u=4, v=5 endpoint
            d[4] = 1;

        a[1] = 1, d[1] = 0 cout 3
        a[1] = 2, next -1 cout 6
        a[1] = 3, next 3, w=4 , ans w+d[w] = 8
 Sample
    4 : 2 4 1
    1 2 4 1
        x: 1 -> 2 -> 0, y =3
    2 2 4 1
        x: 1 -> 3 -> -1, y=6
    3 2 4 1
        x: 1 -> 4 -> 3 -> 7 => y = 8
 */

struct Edge{
    int from;
    int to;
    int w;
};

int n, a[N], endPoint[N]{0};
ll d[N];
vector<Edge> edges[N];

pair<int, int> getNext(int x){
    int w = a[x];
    x = x+a[x];
    if(x<=0 || x>n) return {x, w};
    return {x-a[x], w+a[x]};
}

void dfs(int u){
    for (auto e:edges[u]){
        d[e.to] = d[e.from] + e.w;
        dfs(e.to);
    }
}

int main() {
//    ifstream in;
//    in.open("/Users/Tom/Program/algo/programming_challenge/data/input.txt");
//    std::cin.rdbuf(in.rdbuf()); //redirect std::cin to in.txt!

    cin >> n;
    go(i,2,n) cin >> a[i];
    memset(d, -1, sizeof(d));
    go(u,2,n){
        auto p = getNext(u);
        int v=p.first, w = p.second;
        if (v <= 0 || v>n){
            d[u] = w;
            endPoint[u] = 1;
        } else {
            edges[v].push_back({v,u,w});
        }
    }
    go(u,2,n) if (endPoint[u]) dfs(u);

    go(i,1,n-1){
        a[1] = i;
        auto p = getNext(1);
        int v=p.first, w = p.second;
        if(v<=0 || v>n) cout << w << endl;
        else if(v==1 || d[v] == -1) cout << -1 << endl;
        else cout << d[v] + w << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200005],vis[200004][2];
long long dp[200005][2];
int n;
void  dfs(int x,int flag){
    if(vis[x][flag]) return ;
    vis[x][flag]=1;
    int nex;
    if(flag) nex=x-a[x];
    else nex=x+a[x];
    if(nex<=0||nex>n) dp[x][flag]=a[x];
    else {
        dfs(nex,flag^1);
        if(dp[nex][flag^1]!=-1) dp[x][flag]=dp[nex][flag^1]+a[x];
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    memset(dp,-1,sizeof dp);
    memset(vis,0,sizeof vis);
//    vis[1][0]=1;
//    vis[1][1]=1;
//    dp[1][1]=0;
    for(int i=2;i<=n;i++)
        cin>>a[i];
    for(int i=2;i<=n;i++)
        dfs(i,1);
    for(int i=2;i<=n;i++)
        if(dp[i][1]!=-1)
            cout<<dp[i][1]+i-1<<endl;
        else cout<<dp[i][1]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int a[200005],vis[200004][2];
long long dp[200005][2];
int n;
void  dfs(int x,int flag){
    if(vis[x][flag]) return ;
    vis[x][flag]=1;
    int nex;
    if(flag) nex=x-a[x];
    else nex=x+a[x];
    if(nex<=0||nex>n) dp[x][flag]=a[x];
    else {
        dfs(nex,flag^1);
        if(dp[nex][flag^1]!=-1) dp[x][flag]=dp[nex][flag^1]+a[x];
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    memset(dp,-1,sizeof dp);
    memset(vis,0,sizeof vis);
    vis[1][0]=1;
    vis[1][1]=1;
    dp[1][1]=0;
    for(int i=2;i<=n;i++)
        cin>>a[i];
    for(int i=2;i<=n;i++)
        dfs(i,1);
    for(int i=2;i<=n;i++)
        if(dp[i][1]!=-1)
            cout<<dp[i][1]+i-1<<endl;
        else cout<<dp[i][1]<<endl;
}


#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 7;
int n;
long long a[N], b[2][N], c[2][N], cntr, pre;
long long solve(int pos, int wh) {
  if(pos <= 0 || pos > n) return 0;
  if(pos == 1 || c[wh][pos] == cntr) return -1;
  else if(c[wh][pos] == 0) {
    c[wh][pos] = cntr;
    long long res = solve(pos + (wh ? -a[pos] : a[pos]), wh ^ 1);
    if(res == -1) b[wh][pos] = -1;
    else b[wh][pos] = res + a[pos];
  }
  return b[wh][pos];
}
int main() {
  #ifndef ONLINE_JUDGE
    freopen("I.in","r",stdin);
  #endif
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for(int i = 2; i <= n; i++) cin >> a[i];
  for(int i = 1; i < n; i++) {
    cntr++;
    pre = solve(i + 1, 1);
    if(pre < 0) pre = -1;
    else pre = pre + i;
    cout << pre << '\n';
  }
  return 0;
}


#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;

int n;
lli a[212345];
lli  dp[ 212345 ][ 2 ];
bool fi[ 212345 ][ 2 ];
int vis[ 212345 ][ 2 ];

lli go( int x , int t )
{
    if ( x <= 0 || x > n ) return 0;

    if ( vis[x][t] == 1 )
    {
        if ( x == 1 )
        {
            if ( t == 1 ) return -1;
            if ( t == 2 ) { fi[x][t] = true; return 0; }
        }

        return -1;
    }

    if ( vis[x][t] == 2 )
    {
        return dp[x][t];
    }

    vis[x][t] = 1;

    if ( t == 1 )
    {
        lli get = go( x+a[x] , 2 );
        vis[x][t] = 2;

        if ( get == -1 )
            return dp[x][t] = get;

        fi[x][t] = fi[x+a[x]][2];
        return dp[x][t] = a[x] + get;
    }
    else
    {
        lli get = go( x-a[x] , 1 );
        vis[x][t] = 2;

        if ( get == -1 )
            return dp[x][t] = get;

        fi[x][t] = fi[x-a[x]][1];
        return dp[x][t] = a[x] + get;
    }
}

int main()
{
	cin>>n;
    for ( int i=2 ; i<=n ; i++ ) cin>>a[i];

    for ( int i=1 ; i<n ; i++ )
        if ( vis[i][1] == 0 )
        {
            vis[1][1] = 0;
            vis[1][2] = 0;
            fi[1][1] = fi[1][2] = false;
            a[1] = i;
            lli ans = go( 1 , 1 );
            ans += ans!=-1 && fi[1][1] ? i : 0;

            cout<<ans<<"\n";
        }

	return 0;
}


#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;

int n;
lli a[212345];
lli  dp[ 212345 ][ 2 ];
int vis[ 212345 ][ 2 ];

lli go( int x , int t )
{
    if ( x <= 0 || x > n ) return 0;

    if ( vis[x][t] == 1 )
    {
        return -1;
    }

    if ( vis[x][t] == 2 )
    {
        return dp[x][t];
    }

    vis[x][t] = 1;

    if ( t == 1 )
    {
        lli get = go( x+a[x] , 2 );
        vis[x][t] = 2;

        if ( get == -1 )
            return dp[x][t] = get;

        return dp[x][t] = a[x] + get;
    }
    else
    {
        lli get = go( x-a[x] , 1 );
        vis[x][t] = 2;

        if ( get == -1 )
            return dp[x][t] = get;

        return dp[x][t] = a[x] + get;
    }
}

int main()
{
	cin>>n;
    for ( int i=2 ; i<=n ; i++ ) cin>>a[i];

    for ( int i=1 ; i<n ; i++ )
    {
        vis[1][1] = 0;
        vis[1][2] = 0;
        a[1] = i;
        lli ans = go( 1 , 1 );
        cout<<ans<<"\n";
    }

	return 0;
}


#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;

int n;
lli a[212345];
lli  dp[ 212345 ][ 2 ];
bool fi[ 212345 ][ 2 ];
int vis[ 212345 ][ 2 ];

lli go( int x , int t )
{
    if ( x <= 0 || x > n ) return 0;

    if ( vis[x][t] == 1 )
    {
        if ( x == 1 )
        {
            if ( t == 1 ) return -1;
            if ( t == 2 ) { fi[x][t] = true; return 0; }
        }

        return -1;
    }

    if ( vis[x][t] == 2 )
    {
        return dp[x][t];
    }

    vis[x][t] = 1;

    if ( t == 1 )
    {
        lli get = go( x+a[x] , 2 );
        vis[x][t] = 2;

        if ( get == -1 )
            return dp[x][t] = get;

        fi[x][t] = fi[x+a[x]][2];
        return dp[x][t] = a[x] + get;
    }
    else
    {
        lli get = go( x-a[x] , 1 );
        vis[x][t] = 2;

        if ( get == -1 )
            return dp[x][t] = 6get;

        fi[x][t] = fi[x-a[x]][1];
        return dp[x][t] = a[x] + get;
    }
}

int main()
{
	cin>>n;
    for ( int i=2 ; i<=n ; i++ ) cin>>a[i];

    for ( int i=1 ; i<n ; i++ )
        if ( vis[i][1] == 0 )
        {
            vis[1][1] = 0;
            vis[1][2] = 0;
            fi[1][1] = fi[1][2] = false;
            a[1] = i;
            lli ans = go( 1 , 1 );
            ans += ans!=-1 && fi[1][1] ? i : 0;

            cout<<ans<<"\n";
        }

	return 0;
}


#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;

int n;
lli a[212345];
lli dp [ 212345 ][ 2 ];
bool fi[ 212345 ][ 2 ];
int vis[ 212345 ][ 2 ];

lli go( int x , int t )
{
    if ( x <= 0 || x > n ) return 0;

    if ( vis[x][t] == 1 )
    {
        if ( x == 1 )
        {
            if ( t == 1 ) return -1;
            if ( t == 2 ) { fi[x][t] = true; return 0; }
        }

        return -1;
    }

    if ( vis[x][t] == 2 )
    {
        return dp[x][t];
    }

    vis[x][t] = 1;

    if ( t == 1 )
    {
        lli get = go( x+a[x] , 2 );
        vis[x][t] = 2;

        if ( get == -1 )
            return get;

        fi[x][t] = fi[x+a[x]][t];
        return dp[x][t] = a[x] + get;
    }
    else
    {
        lli get = go( x-a[x] , 1 );
        vis[x][t] = 2;

        if ( get == -1 )
            return get;

        fi[x][t] = fi[x-a[x]][t];
        return dp[x][t] = a[x] + get;
    }
}

int main()
{
	cin>>n;
    for ( int i=2 ; i<=n ; i++ ) cin>>a[i];

    for ( int i=1 ; i<n ; i++ )
        if ( vis[i][1] == 0 )
        {
            vis[1][1] = 0;
            vis[1][2] = 0;
            fi[1][1] = fi[1][2] = false;
            a[1] = i;
            lli ans = go( 1 , 1 );
            ans += ans!=-1 && fi[1][1] ? i : 0;

            cout<<ans<<"\n";
        }

	return 0;
}