Even if the world is full of counterfeits, I still regard it as wonderful.Pile up herbs and incense, and arise again from the flames and ashes of its predecessor — as is known to many, the phoenix does it like this.The phoenix has a rather long lifespan, and reincarnates itself once every a! years. Here a! denotes the factorial of integer a, that is, a! = 1 × 2 × ... × a. Specifically, 0! = 1.Koyomi doesn't care much about this, but before he gets into another mess with oddities, he is interested in the number of times the phoenix will reincarnate in a timespan of b! years, that is, . Note that when b ≥ a this value is always integer.As the answer can be quite large, it would be enough for Koyomi just to know the last digit of the answer in decimal representation. And you're here to provide Koyomi with this knowledge.

The first and only line of input contains two space-separated integers a and b (0 ≤ a ≤ b ≤ 1018).

Output one line containing a single decimal digit — the last digit of the value that interests Koyomi.

NoteIn the first example, the last digit of  is 2;In the second example, the last digit of  is 0;In the third example, the last digit of  is 2.

import java.io.*;
import java.util.*;
import java.math.*;
public class GFG {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		BigInteger a=sc.nextBigInteger();
		BigInteger b=sc.nextBigInteger();
		BigInteger c=b.subtract(a);
		BigInteger ten=new BigInteger("10");
		BigInteger five=new BigInteger("5");
		int x=c.compareTo(five);
		if(x==1)
		System.out.println("0");
		else if(x==0){
		    System.out.println("0");
		}else{
		    int m1=(a.mod(ten)).intValue();
		    int m2=(b.mod(ten)).intValue();
		    int d=m2-m1;
		    if(d<0)
		    System.out.println("0");
		    else
		    {
		        int ans=1;
		        for(int i=m1+1;i<=m2;i++)
		        ans*=i;
		        System.out.println(ans%10);
		    }
		}
	}
}

/*
 * Remember a 2.0 student can know more than a 4.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 */
import java.util.*;
import java.io.*;

import static java.lang.System.out;
//import static java.lang.Math.pow;
//import static java.lang.Math.sqrt;
//import static java.lang.Math.ceil;
//import static java.lang.Math.abs;
//import static java.lang.Math.min;
//import static java.lang.Math.max;
//import static java.lang.Math.floor;
public class ContestMain {
	private static long MOD=1000000007;//10^9+7
	private static final int N=(int) 2e5+5; //200005
	private static Scanner in=new Scanner(System.in);
	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static boolean mark[]=new boolean[N];
//	static int choice=Integer.MAX_VALUE,trav=Integer.MAX_VALUE;

	public static void solve(String s){
	}

	public static void main(String[] args) throws IOException{
		long a=in.nextLong();
		long b=in.nextLong();
		if(b-a>=5)out.println(0);
		else{
			int d=Integer.parseInt((""+b).substring((""+b).length()-1));
			int mult=1;
			for(int i=0;i<(b-a);i++){
				mult*=d;
				d--;
			}
			int res=Integer.parseInt((""+mult).substring((""+mult).length()-1));
			out.println(res);
		}
	}
}

import java.io.*;
import java.util.*;
public class eternal
{
    public static void main(String args[])throws IOException
    {
        Scanner in = new Scanner(System.in);
        long a , b ;
        a=in.nextLong();
        b=in.nextLong();
        long  fb=1 ;
       if(b-a>10)
            System.out.println("0");
       else
       {
        for(long i=a+1;i<=b;i++)

           fb=((fb%10)*(i%10))%10;

           System.out.println((int)(fb));
       }

    }
}

import java.math.BigInteger;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {

		long  a,b;

		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {

			StringTokenizer line = new StringTokenizer(sc.nextLine());
			a = Long.parseLong(line.nextToken());
			b = Long.parseLong(line.nextToken());

			if(a==b) {System.out.println(1);}
			else if(b-a==1){
				String s = Long.toString(b);
				System.out.println(s.charAt(s.length()-1));

			}

			else {

				String str = Long.toString(b);
				int i =Character.getNumericValue(str.charAt(str.length()-1));
				long counter = b-a-1;

				if(i-counter<=0) {System.out.println(0);}
				else {

				b=i;

					long helper, result = b ;

					for(;counter>0;counter--) {

						helper = b - 1;

						result = result * helper;
						b--;

						}

					String s = Long.toString(result);
					System.out.println(s.charAt(s.length()-1));

				}

				//String s = result.toString();

			}

		}

	}

}

import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class B2
{
    public static void main(String[] args)throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String t1=br.readLine();
        String[] t2=t1.split(" ");
        BigInteger a=new BigInteger(t2[0]);
        BigInteger b=new BigInteger(t2[1]);
        BigInteger facta=BigInteger.ONE;
        BigInteger factb=BigInteger.ONE;
        int flag=-1;
        if(a.compareTo(b)==0)
        {
            System.out.println(1);
        }
        else if(a.compareTo(b)>0)
        {
            while(a.compareTo(b)>0)
            {
                facta=facta.multiply(a);
                a=a.subtract(BigInteger.ONE);
                String res=facta.toString();
                if(res.charAt(res.length()-1)=='0')
                {
                    System.out.println(0);
                    flag=1;
                    break;
                }
            }
            if(flag==-1)
            {
                String res=facta.toString();
                System.out.println(res.charAt(res.length()-1));
            }
        }
        else if(b.compareTo(a)>0)
        {
            BigInteger temp=a;
            a=b;
            b=temp;
            while(a.compareTo(b)>0)
            {
                facta=facta.multiply(a);
                a=a.subtract(BigInteger.ONE);
                String res=facta.toString();
                if(res.charAt(res.length()-1)=='0')
                {
                    System.out.println(0);
                    flag=1;
                    break;
                }
            }
            if(flag==-1)
            {
                String res=facta.toString();
                System.out.println(res.charAt(res.length()-1));
            }
        }
    }
}

import java.util.Scanner;

public class dragonyears {
	static long a, b;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		a = sc.nextLong(); b = sc.nextLong();

		long num;

		num = fact(b);
		System.out.println(num % 10);

	}

	private static long fact(long dif) {
		if(dif == 0) return 1;
		if(dif == 1) return b;
		long fact = 1;
		while(dif > a) {
			fact *= dif;
			fact %= 10;
			if(fact == 0) return 0;
			dif--;
		}
		return fact;
	}

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            if(b-a>10 || a>b) {
                System.out.println("0");
            } else {
                Long tmp = 1L;
                a = a %1000;b=b%1000;
                if(a==0 && b==0)
                    System.out.println("1");
                else{
                    if(b==0) b=1000;
                    while (a<b){

                        a = a+1;
//                    if(a%10==0) continue;
                        tmp = tmp * (a) % 100;
                    }
                    System.out.println(tmp%10);
                }

            }
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();

            if (b == a) {
                out.println(1);
                return;
            }
            if (b - a > 10) {
                out.println(0);
                return;
            }

            if (b % 10 == 0 || (a + 1) % 10 == 0) {
                out.println(0);
                return;
            }

            long ans = 1;
            for (long temp = a + 1; temp <= b; ++temp) {
                String req = Long.toString(temp);
                int len = req.length();
                ans *= req.charAt(len - 1) - '0';
            }
            String ansToStr = Long.toString(ans);
            out.println(ansToStr.charAt(ansToStr.length() - 1));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.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 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 boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

public class Hello {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return str;
        }

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

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

        long nextLong() {

            return Long.parseLong(next());
        }

        BigInteger nextBigIntger() {
            BigInteger bb = new BigInteger(next());
            return bb;
        }
    }
 static long MOD = 1000000007;
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        long a = sc.nextLong();
        long b = sc.nextLong();
        if(b==a)
            System.out.println(1);
        else {
            long ans=b%10,diff=b-a;
            while(diff>1){
                if(ans==0)
                    break;
                long tt = (b-1)%10;
                ans =(ans*(tt))%(MOD);
                b--;
                diff--;
            }
            System.out.println(ans%10);
        }

    }
}

/*
######  ######    #####  ######  ######  #####
 #   #  #    #      #    #    #  #    #    #
 #   #  # #  #      #    # ## #  # ## #    #
 #   #  #  #    #   #    #    #  #    #    #
######  #   #   # # #    #    #  #    #    #
 */
import java.util.*;
import java.io.*;
public class factorial {
    public static void main(String args[] ) throws Exception {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long t = scan.nextLong();
        long t1 = scan.nextLong();
        long res = t1-t;
        long fact =1;
        long ans = 1;
        for(long i=t+1;i <= t1 ;i++){
            ans *= i %10;
            if(ans==0){
                break;
            }
        }
        String ans1 = ""+ans;
        System.out.println(ans1.charAt(ans1.length()-1));

    }

}

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CF869B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		SolutionCF869B sl = new SolutionCF869B();
		BigInteger a = sc.nextBigInteger();
		BigInteger b = sc.nextBigInteger();
		sl.solve(a, b);

	}
}

class SolutionCF869B {
	public void solve(BigInteger a, BigInteger b) {
		BigInteger c = b.subtract(a);
		if (c.compareTo(new BigInteger("4")) == 1) {
			System.out.println("0");
		} else {
			BigInteger d = BigInteger.ONE;
			for (int i = 1; i <= c.intValue(); i++) {
				d = d.multiply(a.add(new BigInteger(i + "")));
			}
			String out = d.toString();
			System.out.println(out.charAt(out.length() - 1));
		}
	}
}

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

public class Main {

    public static void main(String[] args) throws IOException {
        FastReader in = new FastReader();
        long a, b;
        a = in.nextLong();
        b = in.nextLong();
        long r = 1;
        for (long i = a + 1; i <= b; i++) {
            r *= (i % 10L);
            r %= 10L;
            if (r == 0L) break;
        }
        System.out.println(r);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

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

public class Main
{
      public static void main(String[] args)
      {
            Scanner sc = new Scanner(System.in);

           long n = sc.nextLong();
           long m = sc.nextLong();

           long res = 1;

           for(long i = n+1;i<=m;i++)
           {
                 res = (i%10)*(res%10);

                 if(res%10 == 0)
                 {
                       break;
                 }
           }

           System.out.println(res%10);

      }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class df {
	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer toks= new StringTokenizer(in.readLine());
		long a =Long.parseLong(toks.nextToken());
		long b =Long.parseLong(toks.nextToken());
		int c =1;
//		for (int i = 1; i <= a; i++) {
////			out.println(c);
//			c=((c%10)*(i%10))%10;
//		}
		long k=1;
			for (long i = a+1; i <= b; i++) {
				k=((k%10)*(i%10))%10;
				if(k==0)
					i=b;
//				out.println(k);

		}
		out.print(k);
		out.close();
	}
}

import java.util.*;
public class Main
{
     static int fact(int n)
    {
        if(n==0)
        return 1;

        return n*fact(n-1);
    }
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
	long answer = 1;
    if(b - a < 5)
    {
        for(Long i = a + 1; i <= b; i++)
            answer = answer*(i%10);

        answer %= 10;
    }
    else
    {
        answer = 0;
    }
        System.out.println(answer);

	}
}

import java.util.*;
public class The_Eternal_Immortality
{
	public static void main(String ar[])
	{
		Scanner s1 = new Scanner(System.in);
		long a,b;
		a = s1.nextLong();
		b = s1.nextLong();
		if(a == 0 && b!=0)
		{
			if(b>=5)
				System.out.println("0");
			else if(b == 3)
				System.out.println("6");
			else
				System.out.println(b);
		}
		else if(b-a == 1)
			System.out.println(b%10);
		else if(a == b)
			System.out.println("1");
		else if(b-a>=5)
			System.out.println("0");
		else
		{
			int mul = 1;
			for(long i=a+1;i<=b;i++)
			{
				//System.out.println("i: "+i);
				if(i%5==0)
				{
					System.out.println("0");
					return;
				}
				mul *= (i%10);
			}
			System.out.println(mul%10);
		}
		s1.close();
	}
}

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

public class R439B  {
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long a=Math.max(1,in.nextLong()),b=Math.max(1,in.nextLong());
        long ans=1;
        for(long i=b;i>a;i--){
            ans=(ans*(i%10))%10;
            //w.println(ans);
            if (ans==0)
                break;
        }
        w.println(ans);
        w.close();
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

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

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

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

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

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

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        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 int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.util.Scanner;

public class sss {
	 static Scanner read=new Scanner(System.in);

	public static void main(String[] args) {

String a=read.next();
String  b=read.next();
int A;
int B;
int A1=0;
int B1=0;
if (a.length()>=10){
 A=Integer.parseInt(a.substring(a.length()-9 , a.length()));
 A1=Integer.parseInt(a.substring(0 , a.length()-9));
}
else {A=Integer.parseInt(a);
if (A==0) A=1;
}
if (b.length()>=10){
	 B=Integer.parseInt(b.substring(b.length()-9 , b.length()));
	 B1=Integer.parseInt(b.substring(0 , b.length()-9));
	}
	else {
		B=Integer.parseInt(b);
		if (B==0) B=1;
	}

int s=1;
if (A==B && A1==B1) System.out.println(s);
else{
if (B-A-1 >= 10 || A==0 || B==0 || B1-A1>=1) s=0;
else{
for(int i=A+1;i<=B;i++){
	s=s*(i%10);
if (s>=10) s=s%10;

}
}
System.out.println(s);
}
	}}

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

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    OutputStream out = new BufferedOutputStream ( System.out );
    String n = sc.next();
    String m = sc.next();
    int a = Integer.parseInt("" + n.charAt(n.length()-1));
    int b = Integer.parseInt("" + m.charAt(m.length()-1));
    int ans = -1;
    if(((n.length() > 1 && m.length() > 1
        && Integer.parseInt("" + n.charAt(n.length()-2)) <
        Integer.parseInt("" + m.charAt(m.length()-2))) || a >= b ||
       (n.length() < m.length() )) && !n.equals(m)) {
      ans = 0;
    }
    else {
      int temp = 1;
      for(int i = b; i > a; i--) {
      temp *= i;
      }
      ans = temp % 10;
    }
    System.out.println(ans);
  }
}

import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import jdk.nashorn.internal.codegen.CompilerConstants;
import java.math.BigInteger;

public class Solution{
    public static void
         main(String [] args)throws IOException{

        Scanner sc=new Scanner(System.in);
         //BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
           long a=sc.nextLong();
           long b=sc.nextLong();

           long mul=1;
           for(long i=a+1;i<=b;i++){
               long tem=i%10;
               mul=mul*tem;

               if(mul==0)break;

           }
           System.out.println(mul%10);

         }

}

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.LinkedList;

    public  class Sample implements Runnable
    {

          public static void solve()
          {
            long a=l();
            long b=l();
            long num=b-a;
            if(num==0){
              out.println("1");
              return;
            }

            long ans=b%10;
            if(num>=5)
            {
              out.println("0");
              return;
             }
            else
            {

              for(int i=1;i<num;i++)
              { b--;
                ans=((ans)*((b)%10))%10;
              }
            }
            out.println(ans);
     }
          static void khojo(long[] a,HashMap hs,int i,int n,long res)
          {
            if(i>=n)
            {
              if(hs.containsKey(res))
              {
                hs.put(res,(long)hs.get(res)+1L);
              }
              else
              {
                hs.put(res,1L);
              }
            }
            else
            {
              khojo(a,hs,i+1,n,(res^a[i]));
              khojo(a,hs,i+1,n,res);
          }
          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;
            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final 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 long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(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;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

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

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }

import java.util.Scanner;

public class problemooobBB {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();

		long s = 1;;

		for (long c = a+1; c <= b; c++) {
			s *= c;
			s %= 10;

			if (s == 0) {
				System.out.println(0);
				return;
			}
		}
		System.out.println(s);

	}

}

import java.util.*;
/**
 * Created by CUONG on 10/8/2017.
 */
public class PS869B {
    public static void main(String[] args)
    {
        Scanner s= new Scanner(System.in);
        long a= s.nextLong();
        long b= s.nextLong();
        int c= (int)(b%10); int d= (int)(a%10);
        long diff= (b-a); int ans=0;
        if (diff<5)
        {
            int temp=1;
            for (int i=c; i>c-diff; i--)
            {
                temp*=i;
            }
            ans= temp%10;
        }

        System.out.println(ans);
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,m=0,k,h,p=0,x,o,y;
		String st,s1,s2,s3;
		BigInteger c;
		long a,b,j;
		a=in.nextLong();
		b=in.nextLong();
		if(b-a>=10)
		     System.out.println("0");
		else
          {
     		c=new BigInteger("1");
     		for(j=a+1;j<=b;j++)
     		     c=c.multiply(BigInteger.valueOf(j));
     		BigInteger d=c.mod(BigInteger.valueOf(10));
     		System.out.println(d);
          }
     }
}

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

public class reg {
    public static void main(String[] args) {
        Scanner ob = new Scanner(System.in);
        Long a=ob.nextLong();
        Long b=ob.nextLong();
        BigInteger result=new BigInteger("1");
        if(b-a>=10)
            System.out.println("0");
        else if(a==1||a==0)
        {
            for(long i=2;i<=b;i++)
            {
                result=result.multiply(BigInteger.valueOf(i));
            }
            System.out.println(result.mod(BigInteger.valueOf(10)));
        }
        else
        {
            long offset=b-a;
            for(long i=1;i<=offset;i++)
                result=result.multiply(BigInteger.valueOf(a+i));
            System.out.println(result.mod(BigInteger.valueOf(10)));
        }
    }}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		long ans = 1;
		Scanner br = new Scanner(System.in);
		long a = br.nextLong();
		long b = br.nextLong();
		for(long i=a+1;i<=b;i++){
			ans *= i;
			ans %= 10;
			if(ans==0){
				break;
			}
		}
		System.out.println(ans);
	}

}

import java.util.Scanner;
public class code{
    public static void main(String args[]){
      Scanner sc=new Scanner(System.in);
      String a=sc.next();
      String b=sc.next();
      int count=0;
      if(a.length()==b.length())
      {
      for(int i=0;i<a.length()-1;i++){
          if(a.charAt(i)!=b.charAt(i))
          count=1;
      }
      if(count==1)
      System.out.println(0);
      else{
          String s1=""+a.charAt(a.length()-1);
           String s2=""+b.charAt(b.length()-1);
          int a1=Integer.parseInt(s1);
          int b1=Integer.parseInt(s2);
          int c=1;
          for(int i=b1;i>a1;i--)
          c=c*i;
          c=c%10;
          System.out.println(c);
      }
    }
    else
    System.out.println(0);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

/**
 * @author Andrei Chugunov
 */
public class B {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;

    void solve() throws IOException {
        long a = nextLong();
        long b = nextLong();
        long result = 1;

        if (b - a > 10) {
                System.out.println(0);
        } else {
            for (long i = a + 1; i <= b; i++) {
                result = result * (i%10)%10;
            }
            System.out.println(result);
        }
    }

    B() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new B();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return st.nextToken();
    }

    String nextString() throws IOException {
        return br.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.io.*;
import java.util.Arrays;

 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

///**
 //*
  //* @author aman_robotics
// */
public class like_cs01
{

    public static void main(String [] args)throws IOException
    {
        FastReader in=new FastReader(System.in);
        long a=in.nextLong();
        long b=in.nextLong();
        long p=1;
        for(long i=a+1;i<=b;i++){
            p=p*(i%10);
            p=p%10;
            if(p==0)
            break;
        }
        System.out.println(p);
    }

    static class FastReader{

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }

        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}

import java.math.BigInteger;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (b - a > 9) {
            System.out.println(0);
            return;
        }
        if (a == b) {
            System.out.println(1);
            return;
        }

        if (b - a == 1) {
            System.out.println(b % 10);
            return;
        }

        long start = a + 1;
        if (start % 10 == 1 && b % 10 == 2 || start % 10 == 3 && b % 10 == 4 || start % 10 == 6 && b % 10 == 7
                || start % 10 == 8 && b % 10 == 9) {
            System.out.println(2);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 3
                || start % 10 == 6 && b % 10 == 8) {
            System.out.println(6);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 4 ||
                start % 10 == 6 && b % 10 == 9 || start % 10 == 7 && b % 10 == 9) {
            System.out.println(4);
        }  else {
            System.out.println(0);
        }
    }
}

import java.util.*;
public class Q869B
{
	public static void main(String dfg[])
	{
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		long c=b-a;
		long d=b%10;long f=1;
		if(c==0)
		{
			System.out.println(1);
		}
		else if(d==0)
		{
		System.out.println(0);
		}
		else
		{
		for(int x=0;x<c;x++)
		{
			f=f*d--;
			if(f%10==0)
			{
			break;
			}

		}
		System.out.println(f%10);
		}
	}
	}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Created by fengp on 10/10/17.
 */
public class CF869B {
    public static int solve(long a, long b){
        if (b-a>=5)return 0;
        int ans=1;
        for (long c=a+1;c<=b;++c){
            ans*=(c%10);
        }
        return ans%10 ;
    }

    public static void main(String[] args) {

        InputStream input = System.in;
        PrintStream output = System.out;
        if (args.length == 2) {
            try {
                input = CF869B.class.getClassLoader().getResourceAsStream(args[0]);
                output = new PrintStream(args[1]);
            } catch (IOException e) {
                e.printStackTrace();
                return;
            }
        }
        Scanner in = new Scanner(input);
        while (in.hasNextLong()) {
            long a;
            a = in.nextLong();
            long b;
            b = in.nextLong();
            output.println(String.format("%d", solve(a,b)));
        }
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Throwable
	{
		Scanner sc = new Scanner((System.in));
		long a = sc.nextLong() , b = sc.nextLong();
		if(a==b)
		{
			System.out.println(1);
			return;
		}
		long last = b-- % 100;
		BigInteger ten = new BigInteger(10+"");
		while(b > a && last != 0)
		{
			BigInteger tmp = new BigInteger(b+"");
			tmp = tmp.multiply(new BigInteger(last+""));
			last = Integer.parseInt(tmp.mod(ten).toString());
			last %= 10;
			b--;
		}

		System.out.println(last % 10);
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(s));
		}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public String nextLine() throws IOException {return br.readLine();}
		public long nextLong() throws IOException {return Long.parseLong(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public boolean ready() throws IOException {return br.ready();}
	}
}

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

public class Main {
    private void solve() {
        long a = nextLong();
        long b = nextLong();
        int proizv = 1;
        for (long i = a+1; i <= b; i++) {
            proizv*=(i%10);
            proizv%=10;
            if(proizv == 0)break;
        }
        System.out.println(proizv);
        //Идём от а до b берём последнюю цифру и
        //её умножаем с следующей и снова первую от произведения берём тока
    }
/*    private boolean isPrime(long n) {
        for (long i = 2; i <= Math.sqrt(n); i++) {
            if(n%i==0)return false;
        }
        return true;
    }*/

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

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    private void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("input.txt"));
//            out = new PrintWriter(new FileWriter("output.txt"));
            solve();
            br.close();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

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

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

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

import java.util.*;

public class Immortality {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long x = 0;

        long a = sc.nextLong();
        long b = sc.nextLong();

        long fact = 1;

        for(long i = a + 1; i <= b; i++){
            fact = (fact % 10) * (i % 10);
            if(fact % 10 == 0){
                break;
            }
        }

        System.out.println(fact % 10);

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kangtaku
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskB solver = new TaskB();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String a = in.readToken(), b = in.readToken();
      int aLast = a.charAt(a.length() - 1) - '0';
      int c = aLast;
      BigInteger ba = new BigInteger(a);
      BigInteger bb = new BigInteger(b);
      BigInteger bc = bb.subtract(ba);
      int dif;
      if (bc.compareTo(BigInteger.valueOf(5L)) > 0) {
        out.println("0");
      } else {
        dif = bc.intValue();
        int cc = c + 1;
        c = 1;
        for (int i = 0; i < dif; i++) {
          c = c * cc;
          cc++;
        }
        String aa = String.valueOf(c);
        out.println(aa.charAt(aa.length() - 1));
      }
    }

  }

  static class InputReader {
    private InputStream stream;
    private BufferedReader br = null;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
      this.br = new BufferedReader(new InputStreamReader(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 readToken() {
      int c;
      while (isSpaceChar(c = read())) ;
      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);
      while (!isSpaceChar(c = read()))
        result.appendCodePoint(c);
      return result.toString();
    }

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

  }
}

import java.util.Scanner;

public class Main  {
    public static void main(String[] args) {
        long num1;
        long num2;
        long result = 1;
        Scanner kbd = new Scanner(System.in);
        num1 = kbd.nextLong();
        num2 = kbd.nextLong();
        long diff = num2-num1;

        if (num1 == 0) {
            num1 = 1;
        }

        for (int i=0; i<diff; i++){
            if (result == 0) {
                break;
            }
            result *= (num2%10);
            result %= 10;
            num2--;
        }

        System.out.println(result%10);
    }
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long a = sc.nextLong();
		long b = sc.nextLong();
		if(b - a >= 10)out.print(0);
		else {
			int ans = 1;
			for(long i=a + 1; i<=b; i++) {
				ans = ((int)(i%10) * ans)%10;
			}
			out.print(ans);
		}
		out.close();
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(String s) throws FileNotFoundException {	br = new BufferedReader(new FileReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {return br.readLine();}

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

		public boolean ready() throws IOException {return br.ready();}

	}
}

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    long n = input.nextLong();
    long m = input.nextLong();
    long mult = 1;
    if(m-n>=10)
      System.out.println("0");
    else
    {
      for(long i=m;i>n;i--)
        mult = (mult*(i%10))%10;
      System.out.println(mult);
    }
  }
}

import java.io.*;

public class B869 {
	public static void main(String[] args) throws IOException {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		String line = read.readLine();
		long a = Long.parseLong(line.split(" ")[0]);
		long b = Long.parseLong(line.split(" ")[1]);
		if (b / 10 > a / 10) {
			System.out.println(0);
		} else {
			int k = 1;
			for (long i = a % 10 + 1; i <= b % 10; i++) {
				k *= i;
			}
			System.out.println(k % 10);
		}
	}
}

import java.io.*;
import java.util.*;
import java.math.*;
public class GFG {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		BigInteger a=sc.nextBigInteger();
		BigInteger b=sc.nextBigInteger();
		BigInteger c=b.subtract(a);
		BigInteger ten=new BigInteger("10");
		BigInteger five=new BigInteger("5");
		int x=c.compareTo(five);
		if(x==1)
		System.out.println("0");
		else if(x==0){
		    System.out.println("0");
		}else{
		    int m1=(a.mod(ten)).intValue();
		    int m2=(b.mod(ten)).intValue();
		    int d=m2-m1;
		    if(d<0)
		    System.out.println("0");
		    else
		    {
		        int ans=1;
		        for(int i=m1+1;i<=m2;i++)
		        ans*=i;
		        System.out.println(ans%10);
		    }
		}
	}
}

//package codeForces.contests.codeforcesRound439Div2;

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

/**
 * Created by vladix on 10/8/17.
 */
public class problemB {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        BigInteger a = new BigInteger(in.next() + "");
        BigInteger b = new BigInteger(in.next() + "");

        BigInteger subtract = b.subtract(a);

        if (a.equals(b)) {
            System.out.println("1");
        } else if (subtract.compareTo(new BigInteger("5")) >= 0) {
            System.out.println("0");
        } else {
            int iterations = Integer.parseInt(subtract.toString());
            BigInteger result = a.add(BigInteger.ONE);
            for (int i = 0; i < iterations - 1; i++) {
                result = result.multiply(a.add(new BigInteger((i + 2) + "")));
            }

            System.out.println(result.toString().charAt(result.toString().length() - 1));
        }
    }
}

import java.util.*;

public class TheEternalImmortality
{
	public static long boufing(long a, long b)
	{
		if(a==b)
			return 1;
		if(a%10==0 && b%10==0)
			return 0;
		ArrayList<Long> ar = new ArrayList<Long>();
		if(a<b)
		{
			for(long i = b; i>a; i--)
			{
				if(i%10==0)
					return 0;
				ar.add(i%10);

			}
		}
		else
		{
			for(long i=a; i>b; i--)
			{
				if(i%10==0)
					return 0;
				ar.add(i%10);
			}
		}
		long total = ar.get(0);
		for(long i=1; i<(long)Math.abs(a-b); i++)
		{
			total*=ar.get((int)i);
			if(total%10==0)
				return 0;
			if(total > 10)
			{
				total = total%10;
			}
		}
		return total%10;

	}
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long a= scan.nextLong();
		long b = scan.nextLong();
		System.out.println(boufing(a,b));

	}

}

import java.util.Scanner;

public class sss {
	 static Scanner read=new Scanner(System.in);

	public static void main(String[] args) {

String a=read.next();
String  b=read.next();
int A;
int B;
int A1=0;
int B1=0;
if (a.length()>=10){
 A=Integer.parseInt(a.substring(a.length()-9 , a.length()));
 A1=Integer.parseInt(a.substring(0 , a.length()-9));
}
else {A=Integer.parseInt(a);
if (A==0) A=1;
}
if (b.length()>=10){
	 B=Integer.parseInt(b.substring(b.length()-9 , b.length()));
	 B1=Integer.parseInt(b.substring(0 , b.length()-9));
	}
	else {
		B=Integer.parseInt(b);
		if (B==0) B=1;
	}

int s=1;
if (A==B && A1==B1) System.out.println(s);
else{
if (B-A-1 >= 10 || A==0 || B==0 || B1-A1>=1) s=0;
else{
for(int i=A+1;i<=B;i++){
	s=s*(i%10);
if (s>=10) s=s%10;

}
}
System.out.println(s);
}
	}}

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

public class Main {
   private void solve() {
      long a = nextLong();
      long b = nextLong();
      if (b - a >= 10) out.println(0);
      else {
      	long ans = 1;
      	for (long i = a + 1; i <= b; i++) ans = (ans * (i % 10)) % 10;
      	out.println(ans);
      }
   }

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

   BufferedReader br;
   StringTokenizer st;
   PrintWriter out;

   private void run() {
      try {
         br = new BufferedReader(new InputStreamReader(System.in));
         out = new PrintWriter(System.out);
         // br = new BufferedReader(new FileReader("birthday.in"));
         // out = new PrintWriter(new FileWriter("birthday.out"));
         solve();
         br.close();
         out.close();
      } catch (IOException e) {
         e.printStackTrace();
      }
   }

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

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

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

import java.io.*;
import java.util.*;
public class B869
{

    public static void main(String args[])throws IOException
    {
        BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out= new PrintWriter(System.out);
        //double a=in.nextDouble();
        //double b=in.nextDouble();
        StringTokenizer str= new StringTokenizer(br.readLine());
        String a1= str.nextToken();
        String b1= str.nextToken();

        if(a1.equals(b1))
        {
            out.println(1);
            out.flush();
            return;
        }
        int i=0;
        if(a1.length()==b1.length())
        {
            for(i=0; i< a1.length(); i++)
            {
                if(a1.charAt(i)!=b1.charAt(i))
                {
                    break;
                }
            }
        }
        double a= Double.parseDouble(a1.substring(i));
        double b= Double.parseDouble(b1.substring(i));
        double prod=1;

        if(a+1==b)
        prod=b%10;
        else
        {
            x:
            for(i=(int)a+1; i<=b; i++)
            {
                prod*= i%10;
                prod= prod%10;
                if(prod==0)
                break x;
            }
        }
        out.println((long)prod);
        out.flush();
    }

}

import java.util.*;

import java.awt.List;
import java.io.*;
import java.lang.*;

public class code3
	{

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

			//Code starts..

			long a = in.nextLong();
			long b = in.nextLong();

			if(b-a>5)
				pw.println(0);
			else
			{
				long dif = b-a;
				long tmp = 1;
				while(dif-->0)
				{

					tmp *=  (b--)%10;
					tmp %= 10;
				//	pw.println(tmp);
				}

				pw.println(tmp%10);

			}

			//Code ends....

			pw.flush();
			pw.close();
		}

		public static boolean isSubSequence(char[] str2,  String str1)
		{

			int j = 0;
			int m = str1.length();
			int n = str2.length;

			for (int i = 0; i < n && j < m; i++)

				if (str1.charAt(j) == str2[i])

					j++;

			return (j == m);
  }

		static class InputReader
		{

			private final InputStream stream;
			private final 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 String nextLine()
			{
				int c = snext();
				while (isSpaceChar(c))
					c = snext();
				StringBuilder res = new StringBuilder();
				do
				{
					res.appendCodePoint(c);
					c = snext();
				} while (!isEndOfLine(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;
			}

			private boolean isEndOfLine(int c)
			{
				return c == '\n' || c == '\r' || c == -1;
			}

			public interface SpaceCharFilter
		    {
				public boolean isSpaceChar(int ch);
			}
		}
		public static long c = 0;

		public static long mod = 1000000007;
		public static int d;
		public static int p;
		public static int q;
		public static boolean flag;
		public static long INF= Long.MAX_VALUE;

		public static void factSieve(int[] a, int n) {

			for(int i=2; i<=n; i+=2)
				a[i] = 2;

			for(int i=3; i<=n; i+=2)
			{
				if(a[i]==0)
				{
					a[i] = i;

					for(int j=i; j*i<=n; j++)
					{
						a[i*j] = i;
					}
				}
			}

			int k = 1000;
			while(k!=1)
			{
				System.out.print(a[k]+" ");
				k /= a[k];

			}
		}

		public static long floorsqrt(long n) {
			long ans = 0;
			long l = 0;
			long r = n;
			long mid = 0;
			while(l<=r)
			{
				mid = (l+r)/2;
				if(mid*mid==n)
					return mid;

				if(mid*mid>n)
				{
					r = mid-1;
				}
				else
				{
					ans = mid;
					l = mid+1;
				}

			}

			return ans;
		}

		public static long fun(int[] a, int[] b, int m,int n) {
			long result =0;
			for(int i=0; i<m; i++)
				for(int j=0; j<m; j++)
				{
					long[] fib  = new long[Math.max(2, n+2)];
					fib[1] = a[i];
					fib[2] = b[j];
					for(int k=3; k<=n; k++)
						fib[k] = (fib[k-1]%mod + fib[k-2]%mod)%mod;
					result = (result%mod + fib[n]%mod)%mod;
				}

			return result;

		}

		public static double slope(pair p1, pair p2)
		{
			double m = INF;
			if((p1.x - p2.x)!=0)
			m =  p1.y - p2.y/(p1.x - p2.x);

			return Math.abs(m);

		}

		public static int count(String[] s, int f)
		{
			int count = 0;
			int n = s[0].length();

			if(f==1)
			{
			for(int i = 0; i<n; i++)
			{
				for(int j=0; j<n; j++)
				{
					if(i%2==0)
					{
						if(j%2==0 && s[i].charAt(j)=='0')
							count++;
						if(j%2==1 && s[i].charAt(j)=='1')
							count++;
					}
					if(i%2==1)
					{
						if(j%2==1 && s[i].charAt(j)=='0')
							count++;
						if(j%2==0 && s[i].charAt(j)=='1')
							count++;
					}

				}
			}
			}
			else
			{

			 count = 0;

			for(int i = 0; i<n; i++)
			{
				for(int j=0; j<n; j++)
				{
					if(i%2==1)
					{
						if(j%2==0 && s[i].charAt(j)=='0')
							count++;
						if(j%2==1 && s[i].charAt(j)=='1')
							count++;
					}
					if(i%2==0)
					{
						if(j%2==1 && s[i].charAt(j)=='0')
							count++;
						if(j%2==0 && s[i].charAt(j)=='1')
							count++;
					}

				}
			}

			}

			return count;

		}

		public static  int gcd(int p2, int p22)
		{
		    if (p2 == 0)
		        return (int) p22;
		    return gcd(p22%p2, p2);
		}

		public static int findGCD(int arr[], int n)
		{
		    int result = arr[0];
		    for (int i=1; i<n; i++)
		        result = gcd(arr[i], result);

		    return result;
		}

		public static void nextGreater(long[] a, int[] ans)
		{

			Stack<Integer> stk = new Stack<>();
			stk.push(0);

			for(int i=1; i<a.length; i++)
			{

				if(!stk.isEmpty())
				{
				int s = stk.pop();
				while(a[s]<a[i])
				{
					ans[s] = i;
					if(!stk.isEmpty())
						s = stk.pop();
					else
						break;
				}
				if(a[s]>=a[i])
					stk.push(s);
				}

				stk.push(i);

			}
			return;

		}

		public static void nextGreaterRev(long[] a, int[] ans)
		{

			int n = a.length;
			int[] pans = new int[n];
			Arrays.fill(pans, -1);
			long[] arev = new long[n];
			for(int i=0; i<n; i++)
				arev[i] = a[n-1-i];

			Stack<Integer> stk = new Stack<>();
			stk.push(0);

			for(int i=1; i<n; i++)
			{

				if(!stk.isEmpty())
				{
				int s = stk.pop();
				while(arev[s]<arev[i])
				{
					pans[s] = n - i-1;
					if(!stk.isEmpty())
						s = stk.pop();
					else
						break;
				}
				if(arev[s]>=arev[i])
					stk.push(s);
				}

				stk.push(i);

			}

			//for(int i=0; i<n; i++)
				//System.out.print(pans[i]+" ");

			for(int i=0; i<n; i++)
				ans[i] = pans[n-i-1];

			return;

		}

		public static void nextSmaller(long[] a, int[] ans)
		{

			Stack<Integer> stk = new Stack<>();
			stk.push(0);

			for(int i=1; i<a.length; i++)
			{

				if(!stk.isEmpty())
				{
				int s = stk.pop();
				while(a[s]>a[i])
				{
					ans[s] = i;
					if(!stk.isEmpty())
						s = stk.pop();
					else
						break;
				}
				if(a[s]<=a[i])
					stk.push(s);
				}

				stk.push(i);

			}
			return;

		}

	    public static long lcm(int[] numbers) {
	        long lcm = 1;
	        int divisor = 2;
	        while (true) {
	            int cnt = 0;
	            boolean divisible = false;
	            for (int i = 0; i < numbers.length; i++) {
	                if (numbers[i] == 0) {
	                    return 0;
	                } else if (numbers[i] < 0) {
	                    numbers[i] = numbers[i] * (-1);
	                }
	                if (numbers[i] == 1) {
	                    cnt++;
	                }
	                if (numbers[i] % divisor == 0) {
	                    divisible = true;
	                    numbers[i] = numbers[i] / divisor;
	                }
	            }
	            if (divisible) {
	                lcm = lcm * divisor;
	            } else {
	                divisor++;
	            }
	            if (cnt == numbers.length) {
	                return lcm;
	            }
	        }
	    }
		public static long fact(long n) {

			long factorial = 1;
			 for(int i = 1; i <= n; i++)
		        {
		            factorial *= i;
		        }
			 return factorial;
		}

		public static int lowerLimit(int[] a, int n) {
			int ans = 0;

			int ll = 0;
			int rl = a.length-1;
		//	System.out.println(a[rl]+" "+n);
			if(a[0]>n)
				return 0;
			if(a[0]==n)
				return 1;
			else if(a[rl]<=n)
				return rl+1;

			while(ll<=rl)
			{

				int mid = (ll+rl)/2;
				if(a[mid]==n)
				{
					ans = mid + 1;
					break;
				}

				else if(a[mid]>n)
				{
					rl = mid-1;

				}
				else
				{
					ans = mid+1;
					ll = mid+1;
				}
			}

			return ans;
		}

		public static long choose(long total, long choose){
		    if(total < choose)
		        return 0;
		    if(choose == 0 || choose == total)
		        return 1;
		    return (choose(total-1,choose-1)+choose(total-1,choose))%mod;
		}

		public static int[] suffle(int[] a,Random gen)
		{
			int n = a.length;
			for(int i=0;i<n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int temp = a[ind];
				a[ind] = a[i];
				a[i] = temp;
			}
			return a;
		}

		public static int floorSearch(int arr[], int low, int high, int x)
		{
		    if (low > high)
		        return -1;

		    if (x > arr[high])
		        return high;
		    int mid = (low+high)/2;

		    if (mid > 0 && arr[mid-1] < x && x < arr[mid])
		        return mid-1;

		    if (x < arr[mid])
		        return floorSearch(arr, low, mid-1, x);

		    return floorSearch(arr, mid+1, high, x);
		}

		public static void swap(int a, int b){
			int temp = a;
			a = b;
			b = temp;
		}
		public static ArrayList<Integer> primeFactorization(int n)
		{
			ArrayList<Integer> a =new ArrayList<Integer>();
			for(int i=2;i*i<=n;i++)
			{
				while(n%i==0)
				{
					a.add(i);
					n/=i;
				}
			}
			if(n!=1)
				a.add(n);
			return a;
		}

		public static void sieve(boolean[] isPrime,int n)
		{
			for(int i=1;i<n;i++)
				isPrime[i] = true;

			isPrime[0] = false;
			isPrime[1] = false;

			for(int i=2;i*i<n;i++)
			{
				if(isPrime[i] == true)
				{
					for(int j=(2*i);j<n;j+=i)
						isPrime[j] = false;
				}
			}
		}

		public static int lowerbound(ArrayList<Long> net, long c2) {
			int i=Collections.binarySearch(net, c2);
			if(i<0)
				i = -(i+2);
			return i;

		}
		public static int uperbound(ArrayList<Integer> list, int c2) {
			int i=Collections.binarySearch(list, c2);
			if(i<0)
				i = -(i+1);
			return i;

		}
		public static int uperboundArray(int[] dis, int c2) {
			int i=Arrays.binarySearch(dis, c2);
			if(i<0)
				i = -(i+1);
			return i;

		}

		public static long[] sort(long[] a)
		{
			Random gen = new Random();
			int n = a.length;
			for(int i=0;i<n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				long temp = a[ind];
				a[ind] = a[i];
				a[i] = temp;
			}

			Arrays.sort(a);
			return a;
		}

		public static int[] sort(int[] a)
		{
			Random gen = new Random();
			int n = a.length;
			for(int i=0;i<n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int temp = a[ind];
				a[ind] = a[i];
				a[i] = temp;
			}

			Arrays.sort(a);
			return a;
		}

		public static int GCD(int a,int b)
		{
			if(b==0)
				return a;
			else
				return GCD(b,a%b);
		}

		public static long GCD(long a,long b)
		{
			if(b==0)
				return a;
			else
				return GCD(b,a%b);
		}

		public static void extendedEuclid(int A,int B)
		{
			if(B==0)
			{
				d = A;
				p = 1 ;
				q = 0;
			}
			else
			{
				extendedEuclid(B, A%B);
				int temp = p;
				p = q;
				q = temp - (A/B)*q;
			}
		}

		public static long LCM(long a,long b)
		{
			return (a*b)/GCD(a,b);
		}

		public static int LCM(int a,int b)
		{
			return (a*b)/GCD(a,b);
		}

		public static int binaryExponentiation(int x,int n)
		{
		    int result=1;
		    while(n>0)
		    {
		        if(n % 2 ==1)
		            result=result * x;
		        x=x*x;
		        n=n/2;
		    }
		    return result;
		}

		public static int[] countDer(int n)
	    {
	        int der[] = new int[n + 1];

	        der[0] = 1;
	        der[1] = 0;
	        der[2] = 1;

	        for (int i = 3; i <= n; ++i)
	            der[i] = (i - 1) * (der[i - 1] + der[i - 2]);

	        // Return result for n
	        return der;
	    }

		 static long binomialCoeff(int n, int k)
		    {
		    long C[][] = new long[n+1][k+1];
		    int i, j;

		        // Calculate  value of Binomial Coefficient in bottom up manner
		    for (i = 0; i <= n; i++)
		    {
		        for (j = 0; j <= Math.min(i, k); j++)
		        {
		            // Base Cases
		            if (j == 0 || j == i)
		                C[i][j] = 1;

		            // Calculate value using previosly stored values
		            else
		                C[i][j] = C[i-1][j-1] + C[i-1][j];
		          }
		     }

		    return C[n][k];
		    }

		public static long binaryExponentiation(long x,long n)
		{
		    long result=1;
		    while(n>0)
		    {
		        if(n % 2 ==1)
		            result=result * x;
		        x=(x%mod * x%mod)%mod;
		        n=n/2;
		    }
		    return result;
		}

		public static int modularExponentiation(int x,int n,int M)
		{
		    int result=1;
		    while(n>0)
		    {
		        if(n % 2 ==1)
		            result=(result * x)%M;
		        x=(x*x)%M;
		        n=n/2;
		    }
		    return result;
		}

		public static long modularExponentiation(long x,long n,long M)
		{
		    long result=1;
		    while(n>0)
		    {
		        if(n % 2 ==1)
		            result=(result * x)%M;
		        x=(x*x)%M;
		        n=n/2;
		    }
		    return result;
		}

		public static int modInverse(int A,int M)
		{
		    return modularExponentiation(A,M-2,M);
		}

		public static long modInverse(long A,long M)
		{
		    return modularExponentiation(A,M-2,M);
		}

		public static boolean checkYear(int year)
	    {
			if (year % 400 == 0)
	            return true;

	        if (year % 100 == 0)
	            return false;

	        if (year % 4 == 0)
	            return true;
	        return false;
	    }

		public static boolean isPrime(int n)
		{

		    if (n <= 1)  return false;
		    if (n <= 3)  return true;

		    if (n%2 == 0 || n%3 == 0)
		    	return false;

		    for (int i=5; i*i<=n; i=i+6)
		    {
		        if (n%i == 0 || n%(i+2) == 0)
		           return false;
		    }

		    return true;
		}

		static class pair implements Comparable<pair>

		{
			Integer x, y;
			pair(int x,int y)
			{
				this.x=x;
				this.y=y;
			}

			public int compareTo(pair o) {
				int result = x.compareTo(o.x);
				if(result==0)
					result = y.compareTo(o.y);

				return result;
			}

			public String toString()
			{
				return x+" "+y;
			}

			public boolean equals(Object o)
			{
				if (o instanceof pair)
			    {
					pair p = (pair)o;
					return p.x == x && p.y == y ;
				}
				return false;
			}

			public int hashCode()
			{
				return new Long(x).hashCode()*31 + new Long(y).hashCode();
			}
		}

		static class triplet implements Comparable<triplet>
		{
			Integer x,y,z;
			triplet(int x,int y,int z)
			{
				this.x = x;
				this.y = y;
				this.z = z;
			}

			public  int compareTo(triplet o)
			{
				int result = x.compareTo(o.x);
				if(result==0)
					result =  y.compareTo(o.y);
				if(result==0)
					result = z.compareTo(o.z);

				return result;
			}

			public boolean equlas(Object o)
			{
				if(o instanceof triplet)
				{
					triplet p = (triplet)o;
					return x==p.x && y==p.y && z==p.z;
				}
				return false;
			}

			public String toString()
			{
				return x+" "+y+" "+z;
			}
			public int hashCode()
			{
				return new Long(x).hashCode()*31 + new Long(y).hashCode() + new Long(z).hashCode();
			}
		}

		static class node implements Comparable<node>

		{
			Integer x, y, z;
			node(int x,int y, int z)
			{
				this.x=x;
				this.y=y;
				this.z=z;
			}

			public int compareTo(pair o) {
				int result = x.compareTo(o.x);
				if(result==0)
					result = y.compareTo(o.y);
				if(result==0)
					result = z.compareTo(z);
				return result;
			}

			@Override
			public int compareTo(node o) {
				// TODO Auto-generated method stub
				return 0;
			}
		}
	}

import java.util.*;
public class Immorality{
public static void main(String args[]){

Scanner sc = new Scanner(System.in);
		long x;
		long y;
		long z;
		long w;
		long s=1;
		x = sc.nextLong();
		y = sc.nextLong();
		for(z=x+1;z<=y;z++){
			w=z%10;
			s*=w;
			if(s==0)
				break;
		}
		System.out.println(s%10);
    }
}

import java.io.*;
import java.util.*;
public class eternal
{
    public static void main(String args[])throws IOException
    {
        Scanner in = new Scanner(System.in);
        long a , b ;
        a=in.nextLong();
        b=in.nextLong();
        long  fb=1 ;
       if(b-a>10)
            System.out.println("0");
       else
       {
        for(long i=a+1;i<=b;i++)

           fb=((fb%10)*(i%10))%10;

           System.out.println((int)(fb));
       }

    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.io.*;
import java.util.*;
/**
 *
 * @author rahman
 */
public class B869 {
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b= sc.nextLong();
        if(b==a){
            System.out.println(5/5);
        }
        else{boolean flag = false;
        long prod = 1;
        for(long i = a+1; i<=b; i++){
//            System.out.println("initial "+i);
//            i=i%10;
               long v = i%10;
            //System.out.println("v "+v);
            //i = i%10;
            //System.out.println(i+" i");
            prod = prod * v;
            prod = prod%10;
            //prod = prod%10;
            //System.out.println("prod "+prod);
            if(prod == 0){
                flag = true;
                break;
            }
        }
        if(flag){
            System.out.println(0);
        }
        else{
            System.out.println(prod%10);
        }
        }
    }
}

import java.util.*;
public class Main
{
     static int fact(int n)
    {
        if(n==0)
        return 1;

        return n*fact(n-1);
    }
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
	long answer = 1;
    if(b - a < 5)
    {
        for(Long i = a + 1; i <= b; i++)
            answer = answer*(i%10);

        answer %= 10;
    }
    else
    {
        answer = 0;
    }
        System.out.println(answer);

	}
}

import java.io.PrintWriter;
import java.util.Scanner;

public class phoenix {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out, true);

		long a = (in.nextLong() + 1);
		long b = in.nextLong();

		if (b - a > 10)
		{
			out.println(0);
			System.exit(0);
		}

		long fact = 1;

		for (; a <= b ; a++)
		{
			fact = (fact * (a % 10)) % 10;
		}

		out.println(fact % 10);

		in.close();
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Tako {
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);

		long x = s.nextLong();
		long y = s.nextLong();

		if(x==y){
			System.out.println("1");
		}

		else if(y-x>=5)
			System.out.println("0");
		else{
			long ans = y%10;
			long z = y-x;
			for (int i = 1; i < z; i++) {
				 ans = (ans * (y-i))%10;
			}
			System.out.println(ans%10);
		}
	}
}

import java.util.Scanner;

public class Codeforces869B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long first = in.nextLong();
        long second = in.nextLong();
        long res = 1;
        for (long i = first + 1; i <= second; i++) {
            if (i % 10 == 0) {
                res = 0;
                break;
            } else {
                res *= i;
                res %= 10;
            }
        }
        System.out.println(res);
    }
}

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

public class Main
{
      public static void main(String[] args)
      {
            Scanner sc = new Scanner(System.in);

           long n = sc.nextLong();
           long m = sc.nextLong();

           long res = 1;

           for(long i = n+1;i<=m;i++)
           {
                 res = (i%10)*(res%10);

                 if(res%10 == 0)
                 {
                       break;
                 }
           }

           System.out.println(res%10);

      }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,m=0,k,h,p=0,x,o,y;
		String st,s1,s2,s3;
		BigInteger c;
		long a,b,j;
		a=in.nextLong();
		b=in.nextLong();
		if(b-a>=10)
		     System.out.println("0");
		else
          {
     		c=new BigInteger("1");
     		for(j=a+1;j<=b;j++)
     		     c=c.multiply(BigInteger.valueOf(j));
     		BigInteger d=c.mod(BigInteger.valueOf(10));
     		System.out.println(d);
          }
     }
}

import java.util.Scanner;

public class problemooobBB {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();

		long s = 1;;

		for (long c = a+1; c <= b; c++) {
			s *= c;
			s %= 10;

			if (s == 0) {
				System.out.println(0);
				return;
			}
		}
		System.out.println(s);

	}

}

import java.io.*;
import java.util.Locale;
import java.util.StringTokenizer;

public class B {

    private void solve() throws IOException {
        long a = nextLong();
        long b = nextLong();
        long ans = 0;
        if (b - a < 5) {
            ans = 1;
            for (long i = a + 1; i <= b; i++) {
                ans = (ans * (i % 10)) % 10;
            }
        }
        System.out.println(ans);
    }

    private void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));

            solve();

        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    private BufferedReader br;
    private StringTokenizer in;

    private String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new B().run();
    }

}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class A1008 {
    public static void main(String [] args) /*throws Exception*/ {
        InputStream inputReader = System.in;
        OutputStream outputReader = System.out;
        InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File("input.txt")));new InputReader(inputReader);
        PrintWriter out = new PrintWriter(outputReader);//new PrintWriter(new FileOutputStream(new File("output.txt")));
        Algorithm solver = new Algorithm();
        solver.solve(in, out);
        out.close();
    }
}

class Algorithm {
    void solve(InputReader ir, PrintWriter pw) {

        long a = ir.nextLong(), b = ir.nextLong();
        long lastDigit = 1;

        if (b - a > 9) pw.print(0);
        else {
            for (long i = a + 1; i <= b; i++) {
                lastDigit = (lastDigit * (i % 10)) % 10;
            }

            pw.print(lastDigit);
        }

    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

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

    String nextLine(){
        String fullLine = null;
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                fullLine = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return fullLine;
        }
        return fullLine;
    }

    String [] toArray() {
        return nextLine().split(" ");
    }

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

}

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigInteger;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader in = new Reader();
        long a, b;
        a = in.nextLong();
        b = in.nextLong();
        long r = 1;
        for (long i = a + 1; i <= b; i++) {
            r *= (i % 10L);
            r %= 10L;
            if (r == 0L) break;
        }
        System.out.println(r);
    }

    public static BigInteger factorial(long n) {
        BigInteger result = BigInteger.ONE;
        for (; n > 1; n--) {
            result = result.multiply(BigInteger.valueOf(n));
        }
        return result;
    }

    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();
        }
    }
}

import java.util.Scanner;

public class Main {
    private final static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        int remainOfB =(int)(b % 10);
        long difference = b - a;
        if(difference >= 5) {
            System.out.println(0);
        }
        else if (difference == 0){
            System.out.println(1);
        }
        else {
            int res = remainOfB;
            for(int i=1; i<difference; i++) {
                remainOfB -= 1;
                res *= remainOfB;

            }
            res %= 10;
            System.out.println(res);
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kangtaku
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskB solver = new TaskB();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
      long a = in.readLong(), b = in.readLong();
      long ans = 1;
      for (long i = a + 1; i <= b && ans != 0; i++) {
        ans = (ans * i) % 10;
      }
      out.println(ans);
    }

  }

  static class InputReader {
    private InputStream stream;
    private BufferedReader br = null;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
      this.br = new BufferedReader(new InputStreamReader(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 long readLong() {
      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 boolean isSpaceChar(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

  }
}

import java.util.Scanner;
public class test {
    public static void main(String[] args) {

        Scanner s=new Scanner(System.in);
        long a=s.nextLong();
        long b=s.nextLong();
        long sum=1;
        long g=b%10;
        for(long i=(b-a);i>0;i--){
            sum=(sum*g)%10;
            g--;
            if(sum==0)
                break;
        }

        System.out.println(sum%10);

    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong(), b = sc.nextLong();
        int output = (int)((a + 1) % 10);
        int temp = output + 1;

        for (int i = 0 ; i < b - a - 1 ; i ++) {
            output = (output * temp) % 10;
            temp ++;
            if (output == 0) {
                break;
            }
        }
        if (a == b) {
            output = 1;
        }
        System.out.println(output);
    }
}

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

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        InputReader in = new InputReader(inputStream);
        long a, b;
        a = in.nextLong();
        b = in.nextLong();
        long r = 1;
        for (long i = a + 1; i <= b; i++) {
            r *= (i % 10L);
            r %= 10L;
            if (r == 0L) break;
        }
        System.out.println(r);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn
 */
public class Progra {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();
            if (b - a >= 10) {
                out.println(0);
            } else {
                long ans = 1;
                for (long x = a + 1; x <= b; x++) {
                    ans = ans * (x % 10) % 10;
                }
                out.println(ans);
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

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

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

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

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class ProblemB {

	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);

	static BigInteger perm(long n, long r) {
		BigInteger ans = new BigInteger(n + "");
		for (long i = n - 1, j = r - 1; j > 0; i--, j--) {
			ans = ans.multiply(new BigInteger(i + ""));
		}
//		 System.out.println(ans);
		return ans;
	}

	// 99999999999999997 99999999999999999
	public static void main(String[] args) throws IOException {

		long small = sc.nextLong(), big = sc.nextLong();
		if (small == 0)
			small = 1;
		if (big == 0)
			big = 1;
		if (big == small) {
			System.out.println(1);
		} else {
			long diff = big - small;
			if (diff > 10) {
				System.out.println(0);
				return;
			}
			String s = perm(big, diff).toString();
			System.out.println(s.charAt(s.length() - 1));
		}
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

}

import java.util.*;
import java.lang.Math;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
	    if(a==b) System.out.println(1);
		else if(b%10==0) System.out.println(0);
		else if(b-a>=10) System.out.println(0);

		else{
		List<Long> l = new ArrayList<>();
		for(int i=0;i<b-a;i++) l.add(b-i);
		long s=1;
		for(int i=0;i<l.size();i++){
		    s=s*(l.get(i)%10);
		    s=s%10;
		    if(s==0) break;
		}
		System.out.println(s);
	}
	}
}

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

public class force{
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		long a,b,i,j,f=1;
		a=in.nextLong();
		b=in.nextLong();
		long z=b%10;
		if(a==b)
			f=1;
		else if(z==5&&a%10==4)
				f=5;
		else if((z>5&&(a%10<5))||z==0){
			f=0;
		}
		else if(z<5&&(a%10)<0)
			f=0;
		else if(z==5&&(a%10)<4)
			f=0;
		else if(a<b){
			for(i=b;i>a;i--){
				j=i%10;
				f=(f*j)%10;
				if(f==0||f==5&&(i-1)%2==0){
					f=0;
					break;
				}

			}
		}
		System.out.println(f);

	}
}

import java.util.Scanner;

public class xxx_869B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong(), b=s.nextLong();
        long diff = b-a;
        if(diff>5) // must include a (5 with an even number) or a (10)
        {
            System.out.println(0);
        }
        else if(diff==1)  //  b!/(b-1)! = b
        {
            System.out.println(b%10);

        }
        else if(diff==0)  //  b!/b! = 1
        {
            System.out.println(1);
        }
        else // diff: 2,3,4  // do it manually !
        {
            long res=1;
            for (long x = b; x > a ; x--) {
                res*=x;
                res%=10;
            }
            System.out.println(res%10);
        }

    }
}

import java.util.*;
public class Main{
public static void main(String[] args){

Scanner scan=new Scanner(System.in);
long a=scan.nextLong();
long b=scan.nextLong();

if(b<a){System.out.println("0");}

if(b==a){
	System.out.println("1");
}
if(b>a){

	if(b-a>=5){
		System.out.println("0");
	}else{

		long multiply=1;
	for(long i=a+1;i<=b;i++){
		multiply=multiply*(i%10);

	}

	System.out.println(multiply%10);

	}

}

}
}

import java.util.*;
/**
 * Created by CUONG on 10/8/2017.
 */
public class PS869B {
    public static void main(String[] args)
    {
        Scanner s= new Scanner(System.in);
        long a= s.nextLong();
        long b= s.nextLong();
        int c= (int)(b%10); int d= (int)(a%10);
        long diff= (b-a); int ans=0;
        if (diff<5)
        {
            int temp=1;
            for (int i=c; i>c-diff; i--)
            {
                temp*=i;
            }
            ans= temp%10;
        }

        System.out.println(ans);
    }
}

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

public class ProblemB {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input[] = br.readLine().split(" ");
		long a = Long.parseLong(input[0]);
		long b = Long.parseLong(input[1]);
		long res = 1;
		for (long i = a + 1; i <= b; i++) {
			res = (res * (i % 10)) % 10;
			if (res == 0) break;
		}
		System.out.println(res);
	}

}

import java.util.*;
import java.math.*;
public class TheEternalImmortality {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong();
		long r=1;

			for(long i=a+1; i<=b; i++)
			{
				r = r*(i%10);
				if(r == 0)
					break;
			}

		System.out.println(r%10);
	}

}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,m=0,k,h,p=0,x,o,y;
		String st,s1,s2,s3;
		BigInteger c;
		long a,b,j;
		a=in.nextLong();
		b=in.nextLong();
		if(b-a>=10)
		     System.out.println("0");
		else
          {
     		c=new BigInteger("1");
     		for(j=a+1;j<=b;j++)
     		     c=c.multiply(BigInteger.valueOf(j));
     		BigInteger d=c.mod(BigInteger.valueOf(10));
     		System.out.println(d);
          }
     }
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long a = sc.nextLong();
		long b = sc.nextLong();
		if(b - a >= 10)out.print(0);
		else {
			long ans = 1;
			for(long i=a + 1; i<=b; i++) {
				ans = (i%10 * ans)%10;
			}
			out.print(ans);
		}
		out.close();
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(String s) throws FileNotFoundException {	br = new BufferedReader(new FileReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {return br.readLine();}

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

		public boolean ready() throws IOException {return br.ready();}

	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class df {
	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer toks= new StringTokenizer(in.readLine());
		long a =Long.parseLong(toks.nextToken());
		long b =Long.parseLong(toks.nextToken());
		int c =1;
//		for (int i = 1; i <= a; i++) {
////			out.println(c);
//			c=((c%10)*(i%10))%10;
//		}
		long k=1;
			for (long i = a+1; i <= b; i++) {
				k=((k%10)*(i%10))%10;
				if(k==0)
					i=b;
//				out.println(k);

		}
		out.print(k);
		out.close();
	}
}

import java.util.*;

public class Main2 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        long f = 1;
        for (long e = a + 1; e <= b; e++) {
            f *= e % 10;
            if (f % 10 == 0) {
                System.out.print(0);
                return;
            }
        }

        System.out.print(f % 10);
    }
}

/*
######  ######    #####  ######  ######  #####
 #   #  #    #      #    #    #  #    #    #
 #   #  # #  #      #    # ## #  # ## #    #
 #   #  #  #    #   #    #    #  #    #    #
######  #   #   # # #    #    #  #    #    #
 */
import java.util.*;
import java.io.*;
public class factorial {
    public static void main(String args[] ) throws Exception {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long t = scan.nextLong();
        long t1 = scan.nextLong();
        long res = t1-t;
        long fact =1;
        long ans = 1;
        for(long i=t+1;i <= t1 ;i++){
            ans *= i %10;
            if(ans==0){
                break;
            }
        }
        String ans1 = ""+ans;
        System.out.println(ans1.charAt(ans1.length()-1));

    }

}

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

public class B {
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		BigInteger bg = sc.nextBigInteger();
		BigInteger bg2 = sc.nextBigInteger();
		BigInteger bg3 = BigInteger.ONE;
		while(!(bg.equals(bg2))){
			bg=bg.add(BigInteger.ONE);
			bg3=bg3.multiply(bg);
			String temp = bg3+"";
			if((temp.charAt(temp.length()-1)=='0')){
				break;
			}
		}
		System.out.println(bg3.mod(BigInteger.TEN));
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class mmm
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

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

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

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    /*static class card{
    long up;
    int down;
    public card(long u,int d)
    {
    this.up=u;
    this.down=d;
    }
    }
    static class sort implements Comparator<card>
    {
    public int compare(card o1,card o2)
    {
    if(o1.up!=o2.up)
    return (int)(o1.up-o2.up);
    else
    return (int)(o1.down-o2.down);
    }
    }
    static void shuffle(long a[])
    {
    List<Long> l=new ArrayList<>();
    for(int i=0;i<a.length;i++)
    l.add(a[i]);
    Collections.shuffle(l);
    for(int i=0;i<a.length;i++)
    a[i]=l.get(i);
    }

    static long gcd(long a,long b)
    {
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
    }
    static int ans1=Integer.MAX_VALUE,ans2=Integer.MAX_VALUE,ans3=Integer.MAX_VALUE,ans4=Integer.MAX_VALUE;
    static boolean v[]=new boolean[101];
    static void dfs(Integer so,Set<Integer> s[]){
    if(!v[so.intValue()])
    {
    v[so]=true;
    for(Integer h:s[so.intValue()])
    {
    if(!v[h.intValue()])
    dfs(h,s);
    }
    }
    }
    static class Print{
    public PrintWriter out;
    Print(OutputStream o)
    {
    out=new PrintWriter(o);
    }
    }
    static int CeilIndex(int A[], int l, int r, int key)
    {
    while (r - l > 1) {
    int m = l + (r - l) / 2;
    if (A[m] >= key)
    r = m;
    else
    l = m;
    }

    return r;
    }

    static int LongestIncreasingSubsequenceLength(int A[], int size)
    {
    // Add boundary case, when array size is one
    int[] tailTable = new int[size];
    int len; // always points empty slot
    tailTable[0] = A[0];
    len = 1;
    for (int i = 1; i < size; i++) {
    if (A[i] < tailTable[0])
    // new smallest value
    tailTable[0] = A[i];

    else if (A[i] > tailTable[len - 1])
    // A[i] wants to extend largest subsequence
    tailTable[len++] = A[i];

    else
    // A[i] wants to be current end candidate of an existing
    // subsequence. It will replace ceil value in tailTable
    tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i];
    }
    return len;
    }*/
    /*static int binary(int n)
    {
    int s=1;
    while(n>0)
    {
    s=s<<1;
    n--;
    }
    return s-1;
    }
    static StringBuilder bin(int i,int n)
    {
    StringBuilder s=new StringBuilder();
    while(i>0)
    {
    s.append(i%2);
    i=i/2;
    }
    while(s.length()!=n)
    {
    s.append(0);
    }
    return s.reverse();
    }*/
    public static void main(String args[])
    {
        InputReader sc=new InputReader(System.in);
        String s1=sc.next();
        String s2=sc.next();
        long a=Long.parseLong(s1);
        long b=Long.parseLong(s2);
        if(b-a==1)
        System.out.println(b);
        else
        {
            BigInteger pro=BigInteger.ONE;
            int f=0;
            for(long i=b;i>a;i--)
            {
                if(i%10==0)
                {
                    System.out.println(0);
                    System.exit(0);
                }
                else if(i%2==0)
                {
                    if(f==0)
                    f=1;
                    else
                    {
                         System.out.println(0);
                         System.exit(0);
                    }
                }
                else if(i%5==0)
                {
                    if(f==0)
                    f=1;
                    else
                    {
                         System.out.println(0);
                         System.exit(0);
                    }
                }
                pro=pro.multiply(BigInteger.valueOf(i));
            }
            //System.out.println(pro);
            String p=pro.toString();
            System.out.println(p.charAt(p.length()-1));
        }
    }
}

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

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    OutputStream out = new BufferedOutputStream ( System.out );
    String n = sc.next();
    String m = sc.next();
    int a = Integer.parseInt("" + n.charAt(n.length()-1));
    int b = Integer.parseInt("" + m.charAt(m.length()-1));
    int ans = -1;
    if(a > b) {
      ans = 0;
    }
    else {
      int temp = 1;
      for(int i = b; i > a; i--) {
        temp *= i;
      }
      ans = temp % 10;
    }
    System.out.println(ans);
  }
}

import java.math.BigInteger;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextInt();
        long b = in.nextInt();

        long start = a + 1;
        if (start % 10 == 1 && b % 10 == 2 || start % 10 == 3 && b % 10 == 4 || start % 10 == 6 && b % 10 == 7
                || start % 10 == 8 && b % 10 == 9) {
            System.out.println(2);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 3) {
            System.out.println(6);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 4) {
            System.out.println(4);
        }  else {
            System.out.println(0);
        }
    }
}

import java.util.*;

public class Immortality {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = 0;

        int a = sc.nextInt();
        int b = sc.nextInt();

        int aFact = factorial(a);
        int bFact = factorial(b);

        x = (bFact/aFact) % 10;

        System.out.println(x);

    }

    public static int factorial(int y){
        int fact = 1;
        for(int i=1;i<=y;i++){
            fact=(fact % 10) * (i % 10);
            if(fact % 10 == 0){
                break;
            }
        }
        return fact;

     }

}

import java.util.Scanner;

public class HelloWorld{

     public static void main(String []args){
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();

        if(a == 0 && b > 4){
            System.out.println("0");
        }else{
            System.out.println(fact(a,b));
        }

     }
     public static int fact(int a, int b){
         int diff = b - a;
         int x = (b - diff) + 1;
         int result = 1;
         for(int i = x; i <= b; i++){
             result = result * i;
         }
         return result % 10;

     }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class df {
	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer toks= new StringTokenizer(in.readLine());
		long a =Long.parseLong(toks.nextToken());
		long b =Long.parseLong(toks.nextToken());
		int c =1;
//		for (int i = 1; i <= a; i++) {
////			out.println(c);
//			c=((c%10)*(i%10))%10;
//		}
		long k=1;
			for (long i = a+1; i <= b; i++) {
				k=((k%10)*(i%10))%10;
				out.println(k);

		}
//		out.print(k);
		out.close();
	}
}

/*
 * Remember a 2.0 student can know more than a 4.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 */
import java.util.*;
import java.io.*;

import static java.lang.System.out;
import static java.lang.Math.pow;
//import static java.lang.Math.sqrt;
//import static java.lang.Math.ceil;
//import static java.lang.Math.abs;
//import static java.lang.Math.min;
//import static java.lang.Math.max;
public class ContestMain {
	private static long MOD=1000000007;//10^9+7
	private static final int N=(int) 2e5+5; //200005
	private static Scanner in=new Scanner(System.in);
	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	private static ArrayList<Integer> v[]=new ArrayList[N];
	private static boolean mark[]=new boolean[N];
	static int choice=Integer.MAX_VALUE,trav=Integer.MAX_VALUE;

	public static void main(String[] args) throws IOException{
		long s=in.nextLong();
		long n=in.nextLong();
		double res=pow((double)(n/2.71828),n)/pow((double)(s/2.71828),s);
		if(s!=0)res=(Math.sqrt(n)/Math.sqrt(s))*res;
		else if(n<5){
			long mult=1;
			for(int i=1;i<=n;i++)
				mult*=i;
			res=mult;
		}
		else res=0;
		long final_res=(long)res;
		String p=""+final_res;
		out.println(p.charAt(p.length()-1));
	}
}

import java.math.BigInteger;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {

		long  a,b;

		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {

			StringTokenizer line = new StringTokenizer(sc.nextLine());
			a = Long.parseLong(line.nextToken());
			b = Long.parseLong(line.nextToken());

			if(a==b) {System.out.println(1);}
			else if(b-a==1){System.out.println(b);}

			else {

				String str = Long.toString(b);
				int i =Character.getNumericValue(str.charAt(str.length()-1));
				long counter = b-a-1;

				if(i-counter<=0) {System.out.println(0);}
				else {

				b=i;

					long helper, result = b ;

					for(;counter>0;counter--) {

						helper = b - 1;

						result = result * helper;
						b--;

						}

					String s = Long.toString(result);
					System.out.println(s.charAt(s.length()-1));

				}

				//String s = result.toString();

			}

		}

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();

            if (b - a > 10) {
                out.println(0);
                return;
            }

            if (b % 10 == 0 || (a + 1) % 10 == 0) {
                out.println(0);
                return;
            }

            long ans = 1;
            for (long temp = a + 1; temp <= b; ++temp) {
                String req = Long.toString(temp);
                int len = req.length();
                ans *= req.charAt(len - 1) - '0';
            }
            String ansToStr = Long.toString(ans);
            out.println(ansToStr.charAt(ansToStr.length() - 1));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.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 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 boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }
}

import java.util.*;

public class Main2 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        long f = 1;
        for (long e = a + 1; e <= b; e++) {
            f *= e;
            if (f % 10 == 0) {
                System.out.print(0);
                return;
            }
        }

        System.out.print(f % 10);
    }
}

/*
 * Remember a 2.0 student can know more than a 4.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 */
import java.util.*;
import java.io.*;

import static java.lang.System.out;
import static java.lang.Math.pow;
//import static java.lang.Math.sqrt;
//import static java.lang.Math.ceil;
//import static java.lang.Math.abs;
//import static java.lang.Math.min;
//import static java.lang.Math.max;
public class ContestMain {
	private static long MOD=1000000007;//10^9+7
	private static final int N=(int) 2e5+5; //200005
	private static Scanner in=new Scanner(System.in);
	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	private static ArrayList<Integer> v[]=new ArrayList[N];
	private static boolean mark[]=new boolean[N];
	static int choice=Integer.MAX_VALUE,trav=Integer.MAX_VALUE;

	public static void main(String[] args) throws IOException{
		long s=in.nextLong();
		long n=in.nextLong();
		String p;
		double res=pow((double)(n/2.71828),n)/pow((double)(s/2.71828),s);
		if(s!=0&&s!=1)res=(Math.sqrt(n)/Math.sqrt(s))*res;
		else if((s==0||s==1)&&n<5){
			long mult=1;
			for(int i=1;i<=n;i++)
				mult*=i;
			p=""+mult;
			out.println(p.charAt(p.length()-1));
			return;
		}
		else res=0;
		p=""+res;
		out.println(p.charAt(p.length()-1));
	}
}

import java.util.*;

public class Immortality {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double x = 0;

        double a = sc.nextDouble();
        double b = sc.nextDouble();

        double aFact = 1;
        double bFact = 1;

        for(int i=1;i<=a;i++){

            aFact=aFact*i;
        }

        for(int i=1;i<=b;i++){
            bFact=bFact*i;
        }

        x = bFact/aFact;

        System.out.println(x % 10);

    }
}

import java.util.Scanner;

public class EternalMorality {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		long a = input.nextLong();
		long b = input.nextLong();
		long total=1;
		for(long i=a+1;i<=b;i++){
			int z =(int) i%10;
			//System.out.println(i);
			if(z==0){
				System.out.println(0);
				return;
			}
			total*=z;
			total = total%10;

		}
		System.out.println(total);
	}

}

import java.util.Scanner;

public class EternalImmortality {

    public static void main(String[] args) {
        EternalImmortality eternalImmortality = new EternalImmortality();
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        System.out.println(eternalImmortality.solve(a, b));
    }

    private int solve(int a, int b) {
        int counter = 1;

        for (int i = a+1; i <= b; i++) {
            counter *= lastDigit(i);
            counter = lastDigit(counter);
            if (counter == 0) {
                return 0;
            }
        }

        return counter;
    }

    private int lastDigit(int n) {
        return (n/10) * 10;
    }
}

import java.util.*;
public class Main
{
     static int fact(int n)
    {
        if(n==0)
        return 1;

        return n*fact(n-1);
    }
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		if(b-a<5)
		System.out.println(fact((int)(b-a))%10);
        else
        System.out.println(0);
	}
}

import java.util.Scanner;

public class a_869B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong(), b=s.nextLong();
        long diff = b-a;
        if(diff>1)
        {
            System.out.println(diff%2==1?(diff%10)*2:diff%10);
        }
        else
        {
            System.out.println(b%10);
        }

    }
}

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

public class B {

	public static void main(String[] args)  {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long a = scan.nextLong(), b = scan.nextLong();
		if(b-a >= 10) out.println(0);
		else {
			long res = 1;
			for(long i = a+1; i <= b; i++) res *= i;
			out.println(res%10);
		}
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

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

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

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

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

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

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int cnt=0,i;
        int b = in.nextInt();
        if(b==a){System.out.println("1"); System.exit(0);}
        else if(b-a>9)System.out.println("0");
        else
        { while(a>10){a = a%10;}
          while(b>10){b = b%10;}
         if(a>b)System.out.println("0");
            else if(a==1){
                if(b==2)System.out.println("2");
                else if(b==3)System.out.println("6");
                else if(b==4)System.out.println("4");
                else System.out.println("0");

            }

            else if(a==2){
              if(b==3)System.out.println("3");
                else if(b==4)System.out.println("2");
                else System.out.println("0");

            }

          else if(a==3){
              if(b==4)System.out.println("4");
              else System.out.println("0");

            }

          else if(a==4){
              if(b==5)System.out.println("5");
              else System.out.println("0");

            }

          else if(a==5){
              if(b==6)System.out.println("6");
                else if(b==7)System.out.println("2");
                else if(b==8)System.out.println("6");
                else if(b==9)System.out.println("4");
                else System.out.println("0");

            }

          else if(a==6){
              if(b==7)System.out.println("7");
                else if(b==8)System.out.println("6");
                else if(b==9)System.out.println("4");
              else System.out.println("0");

            }

           else if(a==7){
              if(b==8)System.out.println("8");
                else if(b==9)System.out.println("2");
                else System.out.println("0");

            }

         else if(a==8){
              if(b==9)System.out.println("9");
              else System.out.println("0");

            }
         //else System.out.println("0");

        }

       }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String[] input = scanner.nextLine().split(" ");

        long a = Integer.parseInt(input[0]);
        long b = Integer.parseInt(input[1]);
        //System.out.println(answer);
        String answer1 = String.valueOf(run(a, b));
        System.out.println(answer1.charAt(answer1.length() - 1));
    }

    private static long run(long a, long b){
        long test1 = 1;
        for (long i = 2; i <= a; i++) {
            test1 = (test1 * (i % 10)) % 10;
        }
        //System.out.println(test1);
        return test1;
    }
}

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

public class ProblemB {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input[] = br.readLine().split(" ");
		long a = Long.parseLong(input[0]);
		long b = Long.parseLong(input[1]);
		long res = 1;
		if (a % 10 == 0 || b % 10 == 0) {
			System.out.println(0);
		}else {
		for (long i = a + 1; i <= b; i++) {
			res = (res * (i % 10)) % 10;
		}
		System.out.println(res);
		}
	}

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            if(b-a>10 || a>b) {
                System.out.println("0");
            } else {
                Long tmp = 1L;
                a = a %1000;b=b%1000;
                while (a<b){
                    a = a+1;
//                    if(a%10==0) continue;
                    tmp = tmp * (a) % 100;
                }
                System.out.println(tmp%10);
            }
        }
    }
}

import java.util.*;
public class Main
{
     static long fact(int n,long b)
    {
        long k= b-1;
     for(int i=1;i<n;i++)
     {
         b=b*k;
         k--;
     }
       return b;
    }
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		if(b-a<5)
		System.out.println(fact((int)(b-a),b)%10);
        else
        System.out.println(0);
	}
}

import java.io.*;
import java.util.*;
public class eternal
{
    public static void main(String args[])throws IOException
    {
        Scanner in = new Scanner(System.in);
        long a , b ;
        a=in.nextLong();
        b=in.nextLong();
        long  fb=1 ;
       if(b-a>10)
            System.out.println("0     c");
       else
       {
        for(long i=a+1;i<=b;i++)

           fb=((fb%10)*(i%10))%10;

           System.out.println((int)(fb));
       }

    }
}

import java.util.*;
import java.math.*;
public class TheEternalImmortality {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong();
		long r=1;

		if((b%10 == 0)||(a%10<b%10))
		{
			r=0;
		}
		else
		{
			for(long i=a+1; i<=b; i++)
			{
				r = r*(i%10);
			}
		}

		System.out.println(r%10);
	}

}

import java.util.*;
public class Main{
public static void main(String[] args){

Scanner scan=new Scanner(System.in);
long a=scan.nextLong();
long b=scan.nextLong();

if(b<a){System.out.println("0");}

if(b==a){
	System.out.println("1");
}
if(b>a){

	if(b-a>=5){
		System.out.println("0");
	}else{

		long multiply=1;
	for(long i=a+1;i<=b;i++){
		multiply=multiply*i;

	}

	System.out.println(multiply%10);

	}

}

}
}

import java.util.Scanner;

public class Codeforce {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long a=sc.nextLong();
                long b=sc.nextLong();
                long p=1,t=0;
           t=b-a;
         for(int i=0;i<t;i++){
            p=p*b;
            b--;
         }
         System.out.println(p%10);
       }
}

import java.util.*;

public class EternalImmortality{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        if(a == b){
            System.out.println(1);
            return;
        }
        int res = 1;
        for( int i = a + 1; i <= b; i++){
            res *= i;
        }
        System.out.println(res%10);
    }
}

import java.util.Scanner;

public class a_869B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong(), b=s.nextLong();
        long diff = b-a;
        if(diff>5) // must include a (5 with an even number) or a (10)
        {
            System.out.println(0);
        }
        else if(diff==1)  //  b!/(b-1)! = b
        {
            System.out.println(b%10);

        }
        else if(diff==0)  //  b!/b! = 1
        {
            System.out.println(1);
        }
        else // diff: 2,3,4  // do it manually !
        {
            int res=1;
            for (long x = b; x > a ; x--) {
                res*=x;
                res%=10;
            }
            System.out.println(res%10);
        }

    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 *
 * @author ayman
 */
public class Qualifications {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger a = new BigInteger(sc.next());
        BigInteger b = new BigInteger(sc.next());
        BigInteger re = BigInteger.ONE;
//        System.out.println(a);
//        System.out.println(b);
        int l = (int)(b.add(a.multiply(BigInteger.valueOf(-1)))).longValue();
//        System.err.println(l);
        if (l <= 3 && l > 0) {
//            System.err.println("dsadsd");
            for (int i = l; i >= 0; i--) {
//                System.err.println("dd");

                re = b.multiply(b.subtract(BigInteger.ONE));
            }

            System.out.println(re.remainder(BigInteger.valueOf(10)));
        }else{
            System.out.println("0");
        }

    }
}

import java.util.*;

public class Immortality {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = 0;

        int a = sc.nextInt();
        int b = sc.nextInt();

        int aFact = factorial(a);
        int bFact = factorial(b);

        x = (bFact/aFact) % 10;

        System.out.println(x);

    }

    public static int factorial(int y){
        int fact = 1;
        for(int i=1;i<=y;i++){
            fact=(fact % 10) * (i % 10);
            if(fact % 10 == 0){
                break;
            }
        }
        return fact;

     }

}

import java.util.Arrays;
import java.util.Scanner;

public class Tako {
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);

		long x = s.nextLong();
		long y = s.nextLong();

		if(x==y){
			System.out.println("1");
		}

		if(y-x>=5)
			System.out.println("0");
		else{
			long ans = y%10;
			long z = y-x;
			for (int i = 1; i < z; i++) {
				 ans = (ans * (y-i))%10;
			}
			System.out.println(ans%10);
		}
	}
}

import java.io.*;
import java.util.*;
public class B869
{

    public static void main(String args[])throws IOException
    {
        BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out= new PrintWriter(System.out);
        //double a=in.nextDouble();
        //double b=in.nextDouble();
        StringTokenizer str= new StringTokenizer(br.readLine());
        String a1= str.nextToken();
        String b1= str.nextToken();

        if(a1.equals(b1))
        {
            out.println(1);
            out.flush();
            return;
        }
        int i;
        for(i=0; i< b1.length(); i++)
        {
            if(a1.charAt(i)!=b1.charAt(i))
            {
                break;
            }
        }
        double a= Double.parseDouble(a1.substring(i));
        double b= Double.parseDouble(b1.substring(i));
        double prod=1;

        if(a+1==b)
        prod=b%10;
        else
        {
            x:
            for(i=(int)a+1; i<=b; i++)
            {
                prod*= i%10;
                prod= prod%10;
                if(prod==0)
                break x;
            }
        }
        out.println((long)prod);
        out.flush();
    }

}

	/*package whatever //do not write package name here */
import java.io.*;
import java.util.*;
import java.math.*;
public final  class Contest
{
	 static class FastReader
	    {
	        BufferedReader br;
	        StringTokenizer st;

	        public FastReader()
	        {
	            br = new BufferedReader(new
	                     InputStreamReader(System.in));
	        }

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

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

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

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

	        String nextLine()
	        {
	            String str = "";
	            try
	            {
	                str = br.readLine();
	            }
	            catch (IOException e)
	            {
	                e.printStackTrace();
	            }
	            return str;
	        }
	    }

    public static void main(String args[]) throws IOException
    {
    	FastReader sc=new FastReader();
    	long a=sc.nextLong();
    	long b=sc.nextLong();
    	long res=1;int fl=0;
    	if(b==a)
    	{
    		System.out.println(1);System.exit(0);
    	}
    	while(b>a)
    	{
    		if(b%5==0)
    		{
    			System.out.println(0);fl=1;break;
    		}
    		res*=b;
    		b--;
    	}
    	if(fl==0)
    		System.out.println(res%10);

    }

}

import java.util.*;
public class The_Eternal_Immortality
{
	public static void main(String ar[])
	{
		Scanner s1 = new Scanner(System.in);
		long a,b;
		a = s1.nextLong();
		b = s1.nextLong();
		if((a == 0 || b-a == 1) && b!=0)
		{
			if(b>=5)
				System.out.println("0");
			else
				System.out.println(b);
		}
		else if(a == b)
			System.out.println("1");
		else if(b-a>=5)
			System.out.println("0");
		else
		{
			int mul = 1;
			for(long i=a+1;i<=b;i++)
			{
				//System.out.println("i: "+i);
				if(i%5==0)
				{
					System.out.println("0");
					return;
				}
				mul *= (i%10);
			}
			System.out.println(mul%10);
		}
		s1.close();
	}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforces;
import java.util.*;
/**
 *
 * @author Ashraf
 */
public class ConB {
    public static void main(String []args){
        int a,b;
        Scanner in=new Scanner(System.in);
        a=in.nextInt();
        b=in.nextInt();
        if(a==b){
           System.out.println(1);
           System.exit(0);
        }
        else if(a==0||a==1){
            if(b<10){
                int u=1;
                for(int i=1;i<=b;i++){
                    u=u*i;
                }
                System.out.println(u%10);
                System.exit(0);
            }
            else{
                System.out.println(0);
                System.exit(0);
            }
        }
        else{
            int x=b-a;
            StringBuilder sb=new StringBuilder();
            sb.append("");
            sb.append(b);
            String s=sb.toString();
            char c=s.charAt(s.length()-1);
            int p=Character.getNumericValue(c);
            if(p==0){
                System.out.println(0);
                System.exit(0);
            }
            else{
                int u=1;
                for(int i=0;i<x;i++){
                    u=u*p;
                    p--;
                    if(p==0){
                        System.out.println(0);
                        System.exit(0);
                    }
                }
                System.out.println(u%10);
                System.exit(0);
            }
        }
    }
}

import java.util.*;
import java.io.*;
/**
 *
 * @author alanl
 */
public class Main{
    static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static void main(String[] args) throws IOException{
        long a = readLong(), b = readLong(), diff = b-a, sub = b, sub1 = diff;
        boolean zero = false;
        int cur = 0;
        while(cur<10 && sub1>0){
            sub--;
            sub1--;
            if(sub1==0)break;
            cur++;
            if(sub<1)break;
            if(sub%5==0){
                zero = true;
                break;
            }
        }
        if(zero){
            println(0);
            return;
        }
        else{
            String[]val = Long.toString(b).split("");
            int cnt = Integer.parseInt(val[val.length-1]);
            long ans = 1;
            while(cnt>1&&diff>0){
                ans*=cnt;
                cnt--;
                diff--;
            }
            if(ans==1){
                println(0);
                return;
            }
            val = Long.toString(ans).split("");
            println(val[val.length-1]);
        }
    }
    static String next () throws IOException {
        while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(input.readLine().trim());
        return st.nextToken();
    }
    static long readLong () throws IOException {
        return Long.parseLong(next());
    }
    static int readInt () throws IOException {
        return Integer.parseInt(next());
    }
    static double readDouble () throws IOException {
        return Double.parseDouble(next());
    }
    static char readChar () throws IOException {
        return next().charAt(0);
    }
    static String readLine () throws IOException {
        return input.readLine().trim();
    }
    static void print(Object b) {
        System.out.print(b);
    }
    static void println(Object b) {
        System.out.println(b);
    }
    static void println() {
        System.out.println();
    }
}

import java.util.Scanner;

public class EternalMorality {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		long a = input.nextLong();
		long b = input.nextLong();
		long total=1;
		for(long i=a+1;i<=b;i++){
			int z =(int) i%10;
			//System.out.println(i);
			if(z==0){
				System.out.println(0);
				return;
			}
			total*=z;
			total = total%10;

		}
		System.out.println(total);
	}

}

import java.math.BigInteger;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (a == b) {
            System.out.println(1);
            return;
        }

        if (b - a == 1) {
            System.out.println(b % 10);
            return;
        }

        long start = a + 1;
        if (start % 10 == 1 && b % 10 == 2 || start % 10 == 3 && b % 10 == 4 || start % 10 == 6 && b % 10 == 7
                || start % 10 == 8 && b % 10 == 9) {
            System.out.println(2);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 3
                || start % 10 == 6 && b % 10 == 8) {
            System.out.println(6);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 4 ||
                start % 10 == 6 && b % 10 == 9) {
            System.out.println(4);
        }  else {
            System.out.println(0);
        }
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            if(b-a>10 || a>b) {
                System.out.println("0");
            } else {
                Long tmp = 1L;
                a = a %1000;b=b%1000;
                if(b==0) b=1000;
                while (a<b){

                    a = a+1;
//                    if(a%10==0) continue;
                    tmp = tmp * (a) % 100;
                }
                System.out.println(tmp%10);
            }
        }
    }
}

import java.util.*;

public class Phoenix {
    public static void main (String [] args) {
	Scanner in = new Scanner (System.in);
	long a=in.nextLong();
	long b=in.nextLong();
	long sum=1;
	while(b>a) {
	    sum*=b;
	    b--;
	}
	long last=sum%10;

	System.out.println (last);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

public class Hello {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return str;
        }

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

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

        long nextLong() {

            return Long.parseLong(next());
        }

        BigInteger nextBigIntger() {
            BigInteger bb = new BigInteger(next());
            return bb;
        }
    }
 static long MOD = 1000000007;
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(b==a)
            System.out.println(1);
        else {
            long ans=b,diff=b-a;
            while(diff>1){
                ans =(ans*(b-1))%(MOD);
                b--;
                diff--;
            }
            System.out.println(ans%10);
        }

    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 *
 * @author ayman
 */
public class Qualifications {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger a = new BigInteger(sc.next());
        BigInteger b = new BigInteger(sc.next());
        BigInteger re = BigInteger.ONE;
//        System.out.println(a);
//        System.out.println(b);
        int l = (int)(b.add(a.multiply(BigInteger.valueOf(-1)))).longValue();
//        System.err.println(l);
        if (l <= 10 && l > 0) {
//            System.err.println("dsadsd");
            for (int i = l; i >= 0; i--) {
//                System.err.println("dd");

                re = b.multiply(b.subtract(BigInteger.ONE));
            }

            System.out.println(re.remainder(BigInteger.valueOf(10)));
        }else{
            System.out.println("0");
        }

    }
}

import java.util.*;
import java.math.BigInteger;
public class TheEternalImmortality {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long a,b,i,k;

		a = sc.nextLong();
		b = sc.nextLong();

		i = b -a;
		k =b;

		for(long j = i; j>1;j--)
		{
			k--;
			a = b*(k);
		}

		System.out.println(a%10);

	}

}

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

public class B {
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		BigInteger bg = sc.nextBigInteger();
		BigInteger bg2 = sc.nextBigInteger();
		BigInteger bg3 = BigInteger.ONE;

	while(!(bg.equals(bg2))){
			bg=bg.add(BigInteger.ONE);
			System.out.println(bg.toString());
			bg3=bg3.multiply(bg);
			if(bg3.mod(BigInteger.TEN).equals(0)){
				break;
			}
		}
		System.out.println(bg3.mod(BigInteger.TEN));
	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Throwable
	{
		Scanner sc = new Scanner((System.in));
		long a = sc.nextLong() , b = sc.nextLong();
		long last = b-- % 100;
		BigInteger ten = new BigInteger(10+"");
		while(b > a && last != 0)
		{
			BigInteger tmp = new BigInteger(b+"");
			tmp = tmp.multiply(new BigInteger(last+""));
			last = Integer.parseInt(tmp.mod(ten).toString());
			last %= 10;
			b--;
		}

		System.out.println(last % 10);
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(s));
		}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public String nextLine() throws IOException {return br.readLine();}
		public long nextLong() throws IOException {return Long.parseLong(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public boolean ready() throws IOException {return br.ready();}
	}
}

import java.util.*;
import java.util.ArrayList;
public class Main{

   static class Pair
   {
      int x;
      int y;

      Pair(int x, int y){
         this.x=x;
         this.y=y;
      }

   }

    public static void main(String[] args){

        Scanner param=new Scanner(System.in);
          long n=param.nextLong();
          long s=param.nextLong();
           long sum=1;
           if(n==0){
              System.out.println(s%10);
              return ;
           }
           while(s!=n){
              sum*=s;
              s--;
           }
           System.out.println(sum%10);

}
}

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

public class A{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		long a = Long.parseLong(st.nextToken());
		long b = Long.parseLong(st.nextToken());
		if(a == b)
		{
			System.out.println(1);
			return;
		}
		if(b - a > 4)
		{
			System.out.println(0);
			return;
		}
		if(b - a == 4)
		{
			System.out.println(4);
			return;
		}
		if(b - a == 3)
		{
			System.out.println(6);
			return;
		}
		if(b - a == 2)
		{
			System.out.println(2);
			return;
		}
		if(b - a == 1)
		{
			System.out.println(b % 10);
			return;
		}
	}

}

import java.io.PrintWriter;
import java.util.Scanner;

public class phoenix {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out, true);

		long a = (in.nextLong() + 1);
		long b = in.nextLong();

		if (b - a > 10)
		{
			out.println(0);
			System.exit(0);
		}

		long fact = 1;
		int k=1;
		a %= 100;
		b %= 100;

		for (; a <= b ; a++)
		{
			fact *= a;
			k ++;
			if (k > 10)
			{
				out.println(0);
				System.exit(0);
			}
		}

		out.println(fact % 10);

		in.close();
	}

}

import java.util.Scanner;

public class Codeforce {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long a=sc.nextLong();
                long b=sc.nextLong();
                long p=1,t=0;
           t=b-a;
         for(int i=0;i<t;i++){
            p=p*b;
            b--;
         }
         System.out.println(p%10);
       }
}

import java.util.Scanner;

public class phoenix {
	public static void main(String[] args) {
		long n, m;
		Scanner var1 = new Scanner(System.in);
		n = var1.nextLong();
		m = var1.nextLong();
		System.out.println(factorial(n,m));
	}
	public static long factorial (long var1, long var2) {
		long result = 1;
		long cnt = var2 - var1;
		if (cnt>=10) return 0;
		for (long i=(var1+1); i<=var2; i++) result = (i%10);
		return result%10;
		}
	}

/*
######  ######    #####  ######  ######  #####
 #   #  #    #      #    #    #  #    #    #
 #   #  # #  #      #    # ## #  # ## #    #
 #   #  #  #    #   #    #    #  #    #    #
######  #   #   # # #    #    #  #    #    #
 */
import java.util.*;
import java.io.*;
public class factorial {
    public static void main(String args[] ) throws Exception {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = scan.nextInt();
        int t1 = scan.nextInt();
        int res = t1-t;
        int fact =1;
        if(res>=5){
            System.out.println("0");
        }else{
            for (int c =t+1 ; c <= t1 ; c++ ){
                fact = fact*c;
               // System.out.println(t+" "+t1+" "+c);
            }
            String s = ""+fact;
            System.out.println(s.charAt(s.length()-1));
        }

    }

}

import java.util.*;
public class TheEternalImmortality {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long a,b,i,k;

		a = sc.nextLong();
		b = sc.nextLong();

		i = b-a;
		k =b;

		for(long j =1; j<i;j++)
		{
			k--;
			a = b*(k);

		}

		System.out.println(a%10);

	}

}

import java.util.Scanner;

public class phoenix {
	public static void main(String[] args) {
		long n, m;
		Scanner var1 = new Scanner(System.in);
		n = var1.nextLong();
		m = var1.nextLong();
		System.out.println(factorial(n,m));
	}
	public static long factorial (long var1, long var2) {
		long result = 1;
		long cnt = var2 - var1;
		if (cnt>=10) return 0;
		for (long i=(var1+1); i<=var2; i++) result *= i;
		return result%10;
		}
	}

import java.util.*;

public class The_Eternal_Immortality{
  public static final int MODULO = 10;
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    long a = in.nextLong();
    long b = in.nextLong();
    if( a == 0 ){
      a = 1;
    }
    if( b == 0 ){
      b = 1;
    }
    if( b - a >= MODULO ){
      System.out.println(0);
    }
    else{
      long res = (a+1) % MODULO;
      for( long i = a + 2; i <= b; i++ ){
        long lastDigit = i % MODULO;
        res *= lastDigit;
      }
      System.out.println(res%MODULO);
    }
  }
}

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    long n = input.nextLong();
    long m = input.nextLong();
    long mult = 1;
    for(long i=m;i>n;i--)
      mult = mult*i;
    long g = mult%10;
    System.out.println(g);
  }
}

	/*package whatever //do not write package name here */
import java.io.*;
import java.util.*;
import java.math.*;
public final  class Contest
{
	 static class FastReader
	    {
	        BufferedReader br;
	        StringTokenizer st;

	        public FastReader()
	        {
	            br = new BufferedReader(new
	                     InputStreamReader(System.in));
	        }

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

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

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

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

	        String nextLine()
	        {
	            String str = "";
	            try
	            {
	                str = br.readLine();
	            }
	            catch (IOException e)
	            {
	                e.printStackTrace();
	            }
	            return str;
	        }
	    }

    public static void main(String args[]) throws IOException
    {
    	FastReader sc=new FastReader();
    	long a=sc.nextLong();
    	long b=sc.nextLong();
    	long res=1;int fl=0;
    	while(b>a)
    	{
    		if(b%5==0)
    		{
    			System.out.println(0);fl=1;break;
    		}
    		res*=b;
    		b--;
    	}
    	if(fl==0)
    		System.out.println(res%10);

    }

}

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

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    OutputStream out = new BufferedOutputStream ( System.out );
    String n = sc.next();
    String m = sc.next();
    int a = n.charAt(n.length()-1);
    int b = m.charAt(m.length()-1);
    int ans = -1;
    if(a >= b) {
      ans = 0;
    }
    else {
      int temp = 1;
      for(int i = b; i > a; i--) {
        temp *= i;
      }
      ans = temp % 10;
    }
    System.out.println(ans);
  }
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class EternalImmortality{

	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		long firstValue = scanner.nextLong();
		long secondValue = scanner.nextLong();
		long temp;

		// firstValue always greater than secondValue
		if(secondValue > firstValue){
			temp = secondValue;
			secondValue = firstValue;
			firstValue = temp;
		}

		Boolean isZero = false;
		long lastValue = 0;
		long totalFirst = 1;

		for(long i=secondValue+1; i<=firstValue; i++){
			String value = String.valueOf(totalFirst);
			totalFirst = Integer.parseInt(value.substring(value.length()-1));

			totalFirst = totalFirst*i;

			value = String.valueOf(totalFirst);
			totalFirst = Integer.parseInt(value.substring(value.length()-1));

			lastValue = totalFirst;
			if(value.substring(value.length()-1).equals("0")){
				isZero = true;
				lastValue = 0;
				break;
			}
		}

		System.out.println(lastValue);
	}

}

import java.io.*;
import java.util.*;
public class B869
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out= new PrintWriter(System.out);

        StringTokenizer str= new StringTokenizer(br.readLine());

        long a= Long.parseLong(str.nextToken());
        long b= Long.parseLong(str.nextToken());
        long temp=0;
        if(a>b)
        {
            temp= b;
            b= a;
            a= temp;
        }
        long prod=1;
        int i;
        for(i=(int)a+1; i<=b; i++)
        {
            prod=prod*i;
        }
        out.println(prod%10);
        out.flush();
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
public class GFG {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		BigInteger a=sc.nextBigInteger();
		BigInteger b=sc.nextBigInteger();
		BigInteger c=b.subtract(a);
		BigInteger ten=new BigInteger("10");
		BigInteger five=new BigInteger("5");
		int x=c.compareTo(five);
		if(x==1)
		System.out.println("0");
		else if(x==0){
		    System.out.println("1");
		}else{
		    int m1=(a.mod(ten)).intValue();
		    int m2=(b.mod(ten)).intValue();
		    int d=m2-m1;
		    if(d<0)
		    System.out.println("0");
		    else
		    {
		        int ans=1;
		        for(int i=m1+1;i<=m2;i++)
		        ans*=i;
		        System.out.println(ans%10);
		    }
		}
	}
}

import java.util.*;
public class Main
{
     static long fact(long n,long b)
    {
        long k= b-1 % 10;
        b=b % 10;
     for(int i=1;i<n;i++)
     {
         b=b*k;
         k--;
     }
       return b;
    }
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		if(b-a<5)
		System.out.println(fact((b-a),b)%10);
        else
        System.out.println(0);
	}
}

import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {

		long  a,b;

		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {

			StringTokenizer line = new StringTokenizer(sc.nextLine());
			a = Long.parseLong(line.nextToken());
			b = Long.parseLong(line.nextToken());

			if(a==b) {System.out.println(1);}
			else if(b-a==1){System.out.println(b);}
			else {
				long counter = b-a-1;
				long helper, result=b;

				for(;counter>0;counter--) {

				helper = b - 1;
				result = result * helper;
				b--;

				}

				String s = Long.toString(result);

				System.out.println(s.charAt(s.length()-1));

			}

		}

	}

}

import java.util.Scanner;

public class sss {
	 static Scanner read=new Scanner(System.in);

	public static void main(String[] args) {

String a=read.next();
String  b=read.next();
int A;
int B;
if (a.length()>=10){
 A=Integer.parseInt(a.substring(a.length()-9 , a.length()));
}
else {A=Integer.parseInt(a);
}
if (b.length()>=10){
	 B=Integer.parseInt(b.substring(b.length()-9 , b.length()));
	}
	else {B=Integer.parseInt(b);
	}
int s=1;
if (A+1==0 || B==0) s=0;
else{
if (B-A-1 > 10) s=0;
else{
for(int i=A+1;i<=B;i++){
	s=s*(i%10);
if (s>=10) s=s%10;

}
}
}

System.out.println(s);
	}}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforces;
import java.util.*;
/**
 *
 * @author Ashraf
 */
public class ConB {
    public static void main(String []args){
        int a,b;
        Scanner in=new Scanner(System.in);
        a=in.nextInt();
        b=in.nextInt();
        if(a==b){
           System.out.println(1);
           System.exit(0);
        }
        else if(a==0||a==1){
            if(b<10){
                int u=1;
                for(int i=1;i<=a;i++){
                    u=u*i;
                }
                System.out.println(u%10);
                System.exit(0);
            }
            else{
                System.out.println(0);
                System.exit(0);
            }
        }
        else{
            int x=b-a;
            StringBuilder sb=new StringBuilder();
            sb.append("");
            sb.append(b);
            String s=sb.toString();
            char c=s.charAt(s.length()-1);
            int p=Character.getNumericValue(c);
            if(p==0){
                System.out.println(0);
                System.exit(0);
            }
            else{
                int u=1;
                x=b-a;
                for(int i=0;i<x;i++){
                    u=u*p;
                    p--;
                    if(p==0){
                        System.out.println(0);
                        System.exit(0);
                    }
                }
                System.out.println(u%10);
                System.exit(0);
            }
        }
    }
}

import java.util.*;

public class Phoenix {
    public static void main (String [] args) {
	Scanner in = new Scanner (System.in);
	int a=in.nextInt();
	int b=in.nextInt();
	long sum=1;
	while(b>a) {
	    sum*=b;
	    b--;
	}
	long last=sum%10;

	System.out.println (last);
    }
}

import java.util.Scanner;

public class a_869B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong(), b = s.nextLong();
        long res=1;
        for (long x = b; x > a ; x--) {
            res*=x;
        }
        System.out.println(res%10);
    }
}

import java.util.*;
public class Q869B
{
	public static void main(String dfg[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=b-a;
		if(a==b)
		{
		System.out.println("1");

		}

		else if(c==1)
		{
		System.out.println(b%10);

		}
		else
		{
		int f=1;
		for(int x=1;x<=c;x++)
		{
			f=f*b--;

		}
		System.out.println(f);
		}
	}
}

import java.util.*;
/**
 * Created by CUONG on 10/8/2017.
 */
public class PS869B {
    public static void main(String[] args)
    {
        Scanner s= new Scanner(System.in);
        long a= s.nextLong();
        long b= s.nextLong();
        int c= (int)(b%10); int d= (int)(a%10);
        int diff= (int)(b-a); int ans=0;
        if (diff<5)
        {
            int temp=1;
            for (int i=c; i>c-diff; i--)
            {
                temp*=i;
            }
            ans= temp%10;
        }

        System.out.println(ans);
    }
}

import java.util.Scanner;

public class EternalImmortality {

    public static void main(String[] args) {
        EternalImmortality eternalImmortality = new EternalImmortality();
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        System.out.println(eternalImmortality.solve(a, b));
    }

    private int solve(int a, int b) {
        int counter = 1;

        for (int i = a+1; i <= b; i++) {
            counter *= lastDigit(i);
            counter = lastDigit(counter);
            if (counter == 0) {
                return 0;
            }
        }

        return counter;
    }

    private int lastDigit(int n) {
        return (n/10) * 10;
    }
}

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

public class b{

	public static void main(String []ar){

		long a,b;
		Scanner cs = new Scanner(System.in);
		a = cs.nextLong();
		b = cs.nextLong();

		long result = 0;

		if (b>a && a>0) {
		    result = 1;
		    long i = a+1;
		    while (i<=b) {
		        result *=i;
		        i++;
		    }
		}

		System.out.println(result%10);

	}

}

import java.util.*;

public class Main2 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();

        int f = 1;
        for (int e = a + 1; e <= b; e++) {
            f = f * e;
        }

        System.out.print(f % 10);
    }
}

import java.util.*;

public class EternalImmortality{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        if(a == b){
            System.out.println(1);
            return;
        }
        int res = 1;
        for( int i = a + 1; i <= b; i++){
            res *= i;
        }
        System.out.println(res%10);
    }
}

import java.util.Scanner;

public class Solutions{

     public static void main(String []args){
        Scanner input = new Scanner(System.in);
        long a = input.nextInt();
        long b = input.nextInt();

        System.out.println((b*(b-1))%10);
}
}

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CF869B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		SolutionCF869B sl = new SolutionCF869B();
		BigInteger a = sc.nextBigInteger();
		BigInteger b = sc.nextBigInteger();
		sl.solve(a, b);

	}
}

class SolutionCF869B {
	public void solve(BigInteger a, BigInteger b) {
		BigInteger c = b.subtract(a);
		if (c.intValue() > 4) {
			System.out.println("0");
		} else {
			BigInteger d = BigInteger.ONE;
			for (int i = 1; i <= c.intValue(); i++) {
				d = d.multiply(a.add(new BigInteger(i + "")));
			}
			String out = d.toString();
			System.out.println(out.charAt(out.length() - 1));
		}
	}
}

import java.util.Scanner;

public class dragonyears {
	static long a, b;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		a = sc.nextLong(); b = sc.nextLong();

		long num;

		long dif = b - a;

		dif = dif % 10;
		num = fact(dif);
		System.out.println(num % 10);

	}

	private static long fact(long dif) {
		if(dif == 0) return 0;
		if(dif == 1) return b;
		long fact = 1;
		while(dif > 1) {
			fact *= dif;
			dif--;
		}
		return fact;
	}

}

import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {

		long  a,b;

		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {

			StringTokenizer line = new StringTokenizer(sc.nextLine());
			a = Long.parseLong(line.nextToken());
			b = Long.parseLong(line.nextToken());

			if(a==b) {System.out.println(1);}
			else if(b-a==1){System.out.println(b);}
			else {
				long counter = b-a;
				long helper, result=1;

				for(;counter>0;counter--) {

				helper = b - 1;
				result = result * b * helper;
				b = b - 1;

				}

				String s = Long.toString(result);

				System.out.println(s.charAt(s.length()-1));

			}

		}

	}

}

import java.util.Scanner;

/**
 *
 * @author mustafa
 */
public class B {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a == b)
        {
            System.out.println(1);
            return;
        }

        if (Math.abs(a - b) > 5)
        {
            System.out.println(0);
            return;
        }

        if (a == 0)
        {
            int x = B.faktoriyal(b);
            System.out.println(x % 10);
            return;
        }

        int product = 1;

        for (int i = a + 1; i <= b; i++)
            product *= i;

        System.out.println(product % 10);
    }

    public static int faktoriyal(int n)
    {
        int result = 1;

        for (int i = 1; i <=n; i++)
            result = result * i;

        return result;
    }
}

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

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    OutputStream out = new BufferedOutputStream ( System.out );
    String n = sc.next();
    String m = sc.next();
    int a = Integer.parseInt("" + n.charAt(n.length()-1));
    int b = Integer.parseInt("" + m.charAt(m.length()-1));
    int ans = -1;
    if(a > b) {
      ans = 0;
    }
    else {
      int temp = 1;
      for(int i = b; i > a; i--) {
        temp *= i;
      }
      ans = temp % 10;
    }
    System.out.println(ans);
  }
}

import java.util.Scanner;

public class NewClass2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong(),b = sc.nextLong();
        if ((b-a)<=4) {
            long i,k=1;
            for (i = 0; i < b-a-1;i++ ) {
                k*=(b%10)*((b-1)%10);
            }
            System.out.println((k%10));
        }
        else{
            System.out.println(0);
        }
    }
}

import java.util.Scanner;

public class Test  {
    public static void main(String[] args) {

        int a;
        int b;
        int result = 1;
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        int count = b-a;

        if (a == 0) {
            a = 1;
        }

        for (int i=0; i<count; i++){
            result *= b;
            b--;
        }

        System.out.println(result%10);

        sc.close();
    }
}

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

public class B {

	public static void main(String[] args)  {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long a = scan.nextLong(), b = scan.nextLong();
		if(b-a >= 5) out.println(0);
		else if(b == a) out.println(1);
		else {
			boolean hit = false;
			a++;
			for(long i = a; i <= b; i++) if(i%5 == 0) hit = true;
			if(hit) out.println(0);
			else {
				a %= 5;
				b %= 5;
				long res = 1;
				for(long i = a; i <= b; i++) res *= i;
				out.println(res%10);
			}
		}
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

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

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

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

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

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

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.util.*;
public class TheEternalImmortality {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long a,b,i;

		a = sc.nextLong();
		b = sc.nextLong();

		i = b -a;

		for(long j = i; j>1;j--)
		{
			a = b*(b-1);
		}

		System.out.println(a%10);

	}

}

import java.math.BigInteger;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();

        System.out.println(0);
    }
}

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

public class A{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		long a = Long.parseLong(st.nextToken());
		long b = Long.parseLong(st.nextToken());

		if(b - a == 0){
			System.out.println(1);
			return;
		}
		if(b - a == 1){
			System.out.println(b % 10);
			return;
		}

		int count = 0;

		while(b > a && b % 5 != 0)
		{
			count++;
			b--;
		}

		int[] pos = {4 ,6, 2, 0};

		if(b % 5 != 0)
			System.out.println(pos[count]);
		else
			System.out.println("0");

	}

}

import java.math.BigInteger;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        long start = a + 1;
        if (start % 10 == 1 && b % 10 == 2 || start % 10 == 3 && b % 10 == 4 || start % 10 == 6 && b % 10 == 7
                || start % 10 == 8 && b % 10 == 9) {
            System.out.println(2);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 3
                || start % 10 == 6 && b % 10 == 8) {
            System.out.println(6);
        } else if ((start % 10 == 1 || start % 10 == 2) && b % 10 == 4 ||
                start % 10 == 6 && b % 10 == 9) {
            System.out.println(4);
        }  else {
            System.out.println(0);
        }
    }
}

import java.util.Scanner;

public class dragonyears {
	static long a, b;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		a = sc.nextLong(); b = sc.nextLong();

		long num;

		long dif = b - a;

		dif = dif % 10;
		num = fact(dif);
		System.out.println(num % 10);

	}

	private static long fact(long dif) {
		if(dif == 0) return 0;
		if(dif == 1) return 1;
		long fact = 1;
		while(dif > 1) {
			fact *= dif;
			dif--;
		}
		return fact;
	}

}

import java.io.*;
import java.util.Locale;
import java.util.StringTokenizer;

public class B {

    private void solve() throws IOException {
        int a = nextInt();
        int b = nextInt();
        int ans = 0;
        if (b - a < 5) {
            b = b % 100;
            a = a % 10;
            ans = 1;
            for (int i = a + 1; i <= b; i++) {
                ans = (ans * (i % 10)) % 10;
            }
        }
        System.out.println(ans);
    }

    private void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));

            solve();

        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    private BufferedReader br;
    private StringTokenizer in;

    private String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new B().run();
    }

}

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

public class B {

	public static void main(String[] args)  {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long a = scan.nextLong(), b = scan.nextLong();
		if(b-a >= 5) out.println(0);
		else if(b == a) out.println(1);
		else {
			boolean hit = false;
			a++;
			for(long i = a; i <= b; i++) if(i%5 == 0) hit = true;
			if(hit) out.println(0);
			else {
				a %= 5;
				b %= 5;
				if(a == 1 && b == 2) out.println(2);
				if(a == 1 && b == 3) out.println(6);
				if(a == 1 && b == 4) out.println(4);
				if(a == 2 && b == 3) out.println(6);
				if(a == 2 && b == 4) out.println(4);
				if(a == 3 && b == 4) out.println(2);
			}
		}
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

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

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

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

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

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

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.util.*;
/**
 * Created by CUONG on 10/8/2017.
 */
public class PS869B {
    public static void main(String[] args)
    {
        Scanner s= new Scanner(System.in);
        int a= s.nextInt();
        int b= s.nextInt();
        b=b%10; a=a%10;
        int diff= b-a; int ans=0;
        if (diff<5)
        {
            int temp=1;
            for (int i=b; i>b-diff; i--)
            {
                temp*=i;
            }
            ans= temp%10;
        }

        System.out.println(ans);
    }
}

import java.util.*;
public class The_Eternal_Immortality
{
	public static void main(String ar[])
	{
		Scanner s1 = new Scanner(System.in);
		long a,b;
		a = s1.nextLong();
		b = s1.nextLong();
		if(a == 0 || b-a == 1)
			System.out.println(b%10);
		else if(a == b)
			System.out.println("1");
		else if(b-a>=5)
			System.out.println("0");
		else
		{
			int mul = 1;
			for(long i=a+1;i<=b;i++)
			{
				if(i%5==0)
				{
					System.out.println("0");
					return;
				}
				mul *= (i%10);
			}
			System.out.println(mul%10);
		}
		s1.close();
	}
}

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CF869B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		SolutionCF869B sl = new SolutionCF869B();
		BigInteger a = sc.nextBigInteger();
		BigInteger b = sc.nextBigInteger();
		sl.solve(a, b);

	}
}

class SolutionCF869B {
	public void solve(BigInteger a, BigInteger b) {
		BigInteger c = b.subtract(a);
		if (c.intValue() >= 4) {
			System.out.println("0");
		} else {
			BigInteger d = BigInteger.ONE;
			for (int i = 1; i <= c.intValue(); i++) {
				d = d.multiply(a.add(new BigInteger(i + "")));
			}
			String out = d.toString();
			System.out.println(out.charAt(out.length() - 1));
		}
	}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 *
 * @author ayman
 */
public class Qualifications {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger a = new BigInteger(sc.next());
        BigInteger b = new BigInteger(sc.next());
        BigInteger re = BigInteger.ONE;
//        System.out.println(a);
//        System.out.println(b);
        int l = (int) (b.add(a.multiply(BigInteger.valueOf(-1)))).longValue();
//        System.err.println(l);
        if (l == 0) {
            System.out.println(1);
        } else {
            if (l <= 10 && l > 0) {
//            System.err.println("dsadsd");
                for (int i = l; i >= 0; i--) {
//                System.err.println("dd");

                    re = b.multiply(b.subtract(BigInteger.ONE));
                }

                System.out.println(re.remainder(BigInteger.valueOf(10)));
            } else {
                System.out.println("0");
            }
        }
//                BigInteger fac = BigInteger.ONE;
//
//        for(int i =12; i <= 36; i++){
////            for(int j =i; j < 40; j++){
//                fac = fac.multiply(BigInteger.valueOf(i));
//                System.err.println(fac);
////                for(int k = i; k <= j; k++){
////                    fac *= k;
////                }
////                System.err.println(""+ i + " " + j + " " + fac);
//
////            }
//        }
//

    }
}

import java.util.Scanner;

public class Test  {
    public static void main(String[] args) {

        int a;
        int b;
        int result = 1;
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        int count = b-a;

        if (a == 0) {
            a = 1;
        } else {
            for (int i=0; i<count; i++){
                result *= b;
                b--;
            }
        }

        System.out.println(result%10);

        sc.close();
    }
}

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

public class TheEternalImmortality {

	public static void main(String[] args) {

		BigInteger A,B,C;
		C= new BigInteger("1000000000000000000");

		Scanner src = new Scanner (System.in);

		do
		{
			B = src.nextBigInteger();
		}
		while((B.compareTo(BigInteger.ZERO)==-1)||(B.compareTo(C)==1));

		do
		{
			A = src.nextBigInteger();
		}
		while((A.compareTo(BigInteger.ZERO)==-1)||(A.compareTo(C)==1));

		src.close();

		BigInteger r = fact(B).divide(fact(A));

		if(r.compareTo(BigInteger.TEN)== -1)
		{
			System.out.println(r);
		}
		else
		{
			System.out.println(r.mod(BigInteger.TEN));
		}

	}

	public static BigInteger fact(BigInteger n)
	{
		BigInteger k = BigInteger.ONE;

		while(n.equals(BigInteger.ZERO)== false)
		{
			k = k.multiply(n);
			n = n.subtract(BigInteger.ONE);
		}
		return(k);
	}

}