package no025; import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigDecimal n = new BigDecimal(sc.next()); BigDecimal m = new BigDecimal(sc.next()); try { BigDecimal ans = n.divide(m); ans = ans.stripTrailingZeros(); String s = ans.unscaledValue().toString(); System.out.println(s.charAt(s.length()-1)); } catch (ArithmeticException e) { System.out.println(-1); } } }