function Main(input: string):void {
  const [T, X] = input.split();
  const ans = T / X;
  console.log(ans);
}

import * as fs from 'fs';
Main(fs.readFileSync('/dev/stdin', 'utf8'));


L,R=map(int,input().split())
M=2019
l,r,a=L%M,R%M,M
if l<r and R-L<672:
  for i in range(l,r):
    for j in range(i+1,r+1):
      a=min(a,i*j%M)
      if a<2: break
    if a<2: break
else: a=0
print(a)


L,R = map(int,input().split())
if R - L >= 672:
  print(0)
else:
  l = L%2019
  r = R%2019
  if l > r:
    print(0)
  else:
    a = 2018
    for i in range(l,r):
      for j in range(i+1,r+1):
        a = min((i*j)%2019,a)
        if a == 1:
          print(a)
          exit()
    print(a)


a,b=input().split()
a=int(a)
b=int(b)
c=0
for i in range(a,b+1):
  if b-a>=672:
    c=1
    break
  elif i%673==0:
    c=1
    break
ll=[]
if b-a==1:
  print(a*b%2019)
elif c==1:
  print(0)
elif b-a>=100:
  print(1)
elif b-a>=46:
  print(2)
else:
  for i in range(a,b):
    for j in  range(i+1,b+1):
      ll.append(i*j%2019)
  print(min(ll))


l,r=map(int,input().split())
mod=2019
a=l%mod
b=l//mod
c=r%mod
d=r//mod
if d-b!=0:
  print(0)
else:
  ans=float('inf')
  for i in range(a,c):
    for j in range(i+1,c+1):
      ans=min(ans,i*j)
  print(ans)


l,r=map(int,input().split())
mod=2019
a=l%mod
b=l//mod
c=r%mod
d=r//mod
if b==d:
  print(a*(a+1))
elif d-b==1:
  print(0)
elif d-b>1:
  print(0)


l,r=map(int,input().split())
mod=2019
a=l%mod
b=l//mod
c=r%mod
d=r//mod
if b==d:
  print(a*(a+1))
elif d-b==1:
  print(a)
elif d-b>1:
  print(1)


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

public class Main {

    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String str = br.readLine();
            String input[] = str.split(" ");
            int L = Integer.valueOf(input[0]);
            int R = Integer.valueOf(input[1]);

            int result = 2018;

          if(R-L >2019){
            R = L+2019;
          }
          if(L > 2019 && L/2019 == R/2019){
            L %= 2019;
            R %= 2019;
          }

            for(int i = L; i<R; i++) {
				if(i%2019 == 0 || result == 0){
                  result = 0;
                  break;
                }
              for(int j = i+1; j<=R; j++) {
                  int N = i* j;
                    if( N % 2019 < result && N % 2019 > 0 ) {
                        result = N % 2019;
                    } else if(N%2019 == 0){
                      result = N % 2019;
                      break;
                    }
                }
            }
            System.out.println(result);

        }catch(IOException e) {

        }
    }

}


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

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String in[] = new String[2];
		long l = 0, r = 0;
		try {
			line = br.readLine();
			in = line.split(" ");
			l = Long.parseLong(in[0]);
			r = Long.parseLong(in[1]);
		} catch (IOException e) {
			e.getStackTrace();
		}

		int min = 2020;
		int mod;
		for (long i = l; i < r; i++) {
			for (long j = i+1; j <= r; j++) {
				if(min > (mod =(int) ((i*j) % 2019))) {
					min = mod;
					if(min == 0) break;
				}
			}
			if(min == 0) break;
		}
	System.out.println(min);
	}
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.StringJoiner;

class Main {

    static PrintWriter out;
    static InputReader sc;

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

    static void solve() {
        long L = sc.nextInt();
        long R = sc.nextInt();
        long n3 = (R / 3) - ((L - 1) / 3);
        long n673 = (R / 673) - ((L - 1) / 673);
        if (n3 > 0 && n673 > 0) {
            out.println(0);
            return;
        } else {
            long ans = Integer.MAX_VALUE / 4;
            for (long i = L; i < R; i++) {
                for (long j = i + 1; j <= R; j++) {
                    ans = Math.min(ans, (i * j) % 2019);
                }
            }
            out.println(ans);
        }
    }

    static void debug(Object... args) {
        StringJoiner j = new StringJoiner(" ");
        for (Object arg : args) {
            if (arg == null) {
                j.add("null");
            } else if (arg instanceof int[]) {
                j.add(Arrays.toString((int[]) arg));
            } else if (arg instanceof long[]) {
                j.add(Arrays.toString((long[]) arg));
            } else if (arg instanceof double[]) {
                j.add(Arrays.toString((double[]) arg));
            } else if (arg instanceof Object[]) {
                j.add(Arrays.toString((Object[]) arg));
            } else {
                j.add(arg.toString());
            }
        }
        System.err.println(j.toString());
    }

    static long modinv(long a, int MOD) {
        long b = MOD, u = 1, v = 0;
        long tmp;
        while (b != 0) {
            long t = a / b;
            a -= t * b;

            tmp = a;
            a = b;
            b = tmp;

            u -= t * v;

            tmp = u;
            u = v;
            v = tmp;
        }
        u %= MOD;
        if (u < 0) {
            u += MOD;
        }
        return u;
    }

    static long moddiv(long a, long b, int MOD) {
        a %= MOD;
        return a * modinv(b, MOD) % MOD;
    }

    static long modpow(long a, long n, int MOD) {
        long res = 1;
        while (n > 0) {
            if ((n & 1) == 1) {
                res = res * a % MOD;
            }
            a = a * a % MOD;
            n >>= 1;

        }
        return res;
    }

    static boolean ok(int x, int y, int X, int Y) {
        return 0 <= x && x < X && 0 <= y && y < Y;
    }

    static long gcd(long a, long b) {
        if (a < b) {
            long tmp = a;
            a = b;
            b = tmp;
        }
        long r = a % b;
        while (r != 0) {
            a = b;
            b = r;
            r = a % b;
        }
        return b;
    }

    static int upper_bound(long x, long[] arr) {
        int ok = arr.length;
        int ng = -1;
        while (ok - ng > 1) {
            int mid = (ok + ng) / 2;
            if (arr[mid] <= x) {
                ng = mid;
            } else {
                ok = mid;
            }
        }
        return ok;
    }

    static int lower_bound(long x, long[] arr) {
        int ok = -1;
        int ng = arr.length;
        while (ng - ok > 1) {
            int mid = (ok + ng) / 2;
            if (arr[mid] < x) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        return ok;

    }

    static void reverse(int[] arr) {
        for (int i = 0; i < arr.length / 2; i++) {
            int tmp = arr[i];
            arr[i] = arr[arr.length - i - 1];
            arr[arr.length - i - 1] = tmp;
        }
    }

    static class PaC {
        private long[] fac, finv, inv;
        private int MOD;

        public PaC(int MAX, int MOD) {
            MAX++;
            this.fac = new long[MAX];
            this.finv = new long[MAX];
            this.inv = new long[MAX];
            this.MOD = MOD;

            this.fac[0] = this.fac[1] = 1;
            this.finv[0] = this.finv[1] = 1;
            this.inv[1] = 1;
            for (int i = 2; i < MAX; i++) {
                this.fac[i] = this.fac[i - 1] * i % MOD;
                this.inv[i] = MOD - this.inv[MOD % i] * (MOD / i) % MOD;
                this.finv[i] = this.finv[i - 1] * this.inv[i] % MOD;
            }
        }

        public long combination(int n, int k) {
            if (n < k) {
                return 0;
            }
            if (n < 0 || k < 0) {
                return 0;
            }
            return this.fac[n] * (this.finv[k] * this.finv[n - k] % this.MOD) % this.MOD;
        }

        public long permutation(int n, int k) {
            if (n < k) {
                return 0;
            }
            if (n < 0 || k < 0) {
                return 0;
            }
            return this.fac[n] * (this.finv[n - k] % this.MOD) % this.MOD;
        }

    }

    static class Pair {
        int first;
        int second;

        public Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public String toString() {
            return String.format("%d %d", this.first, this.second);
        }
    }

    static class UnionFind {

        private int[] parent;

        public UnionFind(int n) {
            // 親の番号を格納する。
            // 自分自身が親だった場合は-(その集合のサイズ)を格納する。
            this.parent = new int[n];

            for (int i = 0; i < n; i++) {
                // 最初の時点では親は自分自身
                // 集合のサイズは１
                this.parent[i] = -1;
            }
        }

        // aがどのグループに属しているか調べる。
        public int root(int a) {
            if (this.parent[a] < 0) {
                return a;
            } else {
                // 再帰的に親をたどる。
                return this.parent[a] = this.root(this.parent[a]);
            }
        }

        // aの集合のサイズを返す
        public int size(int a) {
            return -this.parent[this.root(a)];
        }

        // aとbをつなぐ。
        // 大きい方(a)に小さい方(b)をつなぐ感じ。
        public boolean connect(int a, int b) {
            // 親同士をつなぐ。
            a = this.root(a);
            b = this.root(b);

            // すでにくっついている場合
            if (a == b) {
                return false;
            }

            if (this.size(a) < this.size(b)) {
                int r = a;
                a = b;
                b = r;
            }

            this.parent[a] += this.parent[b];
            this.parent[b] = a;

            return true;
        }
    }

    static class Dijkstra {
        private static final long INF = Long.MAX_VALUE / 4;
        Vertex[] g;
        PriorityQueue<PairForDijkstra> que;
        long[] d;

        public Dijkstra(int n) {
            this.g = new Vertex[n];
            this.d = new long[n];
            this.que = new PriorityQueue<>();

            for (int i = 0; i < n; i++) {
                this.g[i] = new Vertex(i);
            }
        }

        public void set(int i, int j, long cost) {
            Vertex u = this.g[i];
            Vertex v = this.g[j];
            u.adj.add(new Edge(cost, v));
            v.adj.add(new Edge(cost, u));
        }

        public void calc(int s) {
            Arrays.fill(this.d, INF);
            this.d[s] = 0;
            this.que.add(new PairForDijkstra(0, this.g[s]));

            while (this.que.size() > 0) {
                PairForDijkstra t = this.que.poll();
                int from = t.now.name;
                List<Edge> toes = t.now.adj;
                if (this.d[from] < t.value) {
                    continue;
                }
                for (Edge e : toes) {
                    int to = e.to.name;
                    long cost = e.w;
                    if (this.d[to] > this.d[from] + cost) {
                        this.d[to] = this.d[from] + cost;
                        this.que.add(new PairForDijkstra(this.d[to], e.to));
                    }
                }
            }
        }

        public long distance(int g) {
            if (this.d[g] == INF) {
                return -1;
            }
            return this.d[g];
        }
    }

    static class Edge {
        long w;
        Vertex to;

        public Edge(long w, Vertex to) {
            this.w = w;
            this.to = to;
        }

    }

    static class Vertex {
        int name;
        List<Edge> adj;

        public Vertex(int name) {
            this.name = name;
            this.adj = new ArrayList<>();
        }

    }

    static class PairForDijkstra implements Comparable<PairForDijkstra> {
        long value;
        Vertex now;

        public PairForDijkstra(long value, Vertex now) {
            this.value = value;
            this.now = now;
        }

        @Override
        public int compareTo(PairForDijkstra o) {

            return Long.compare(this.value, o.value);
        }

    }

    static class ArraysFillEx {

        public static void fill(Object array, Object value) {

            // 第一引数が配列か判定
            Class<?> type = array.getClass();
            if (!type.isArray()) {
                throw new IllegalArgumentException("not array");
            }

            // クラスの型を判定
            String arrayClassName = array.getClass().getSimpleName().replace("[]", "").toLowerCase();
            String valueClassName = value.getClass().getSimpleName().toLowerCase().replace("character", "char")
                    .replace("integer", "int");
            if (!arrayClassName.equals(valueClassName)) {
                throw new IllegalArgumentException("does not match");
            }

            // 処理
            if (type.getComponentType().isArray()) {
                for (Object o : (Object[]) array) {
                    fill(o, value);
                }
            } else if (array instanceof boolean[]) {
                Arrays.fill((boolean[]) array, (boolean) value);
            } else if (array instanceof char[]) {
                Arrays.fill((char[]) array, (char) value);
            } else if (array instanceof byte[]) {
                Arrays.fill((byte[]) array, (byte) value);
            } else if (array instanceof short[]) {
                Arrays.fill((short[]) array, (short) value);
            } else if (array instanceof int[]) {
                Arrays.fill((int[]) array, (int) value);
            } else if (array instanceof long[]) {
                Arrays.fill((long[]) array, (long) value);
            } else if (array instanceof float[]) {
                Arrays.fill((float[]) array, (float) value);
            } else if (array instanceof double[]) {
                Arrays.fill((double[]) array, (double) value);
            } else {
                Arrays.fill((Object[]) array, value);
            }
        }

    }

    static class InputReader {

        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int curbuf;
        private int lenbuf;

        public InputReader(InputStream in) {
            this.in = in;
            this.curbuf = this.lenbuf = 0;
        }

        public boolean hasNextByte() {
            if (this.curbuf >= this.lenbuf) {
                this.curbuf = 0;
                try {
                    this.lenbuf = this.in.read(this.buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (this.lenbuf <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (this.hasNextByte()) {
                return this.buffer[this.curbuf++];
            } else {
                return -1;
            }
        }

        private boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        private void skip() {
            while (this.hasNextByte() && this.isSpaceChar(this.buffer[this.curbuf])) {
                this.curbuf++;
            }
        }

        public boolean hasNext() {
            this.skip();
            return this.hasNextByte();
        }

        public String next() {
            if (!this.hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = this.readByte();
            while (!this.isSpaceChar(b)) {
                sb.appendCodePoint(b);
                b = this.readByte();
            }
            return sb.toString();
        }

        public int nextInt() {
            if (!this.hasNext()) {
                throw new NoSuchElementException();
            }
            int c = this.readByte();
            while (this.isSpaceChar(c)) {
                c = this.readByte();
            }
            boolean minus = false;
            if (c == '-') {
                minus = true;
                c = this.readByte();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res = res * 10 + c - '0';
                c = this.readByte();
            } while (!this.isSpaceChar(c));
            return minus ? -res : res;
        }

        public long nextLong() {
            if (!this.hasNext()) {
                throw new NoSuchElementException();
            }
            int c = this.readByte();
            while (this.isSpaceChar(c)) {
                c = this.readByte();
            }
            boolean minus = false;
            if (c == '-') {
                minus = true;
                c = this.readByte();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res = res * 10 + c - '0';
                c = this.readByte();
            } while (!this.isSpaceChar(c));
            return minus ? -res : res;
        }

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

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

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

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

    static void tr(Object... o) {
        out.println(Arrays.deepToString(o));
    }
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        long res;

        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            long l=L-2019*bai;
            long r=R-2019*bai;
            res = l*(l+1);
        }
        System.out.println(res);

        }
    }


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = 2019;
        for (int i=l; i<r; i++) {
            for (int j=i+1; j<=r; j++) {
                if (i * j % 2019 < min) {
                    min = i * j % 2019;
                }
                if (min == 0) break;
            }
            if (min == 0) break;
        }
        System.out.print(min);
    }
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m = 2019;
		int l = sc.nextInt();
		int r = sc.nextInt();

		int lm = l % m;
		int rm = r % m;
		int ld = l / m;
		int rd = r / m;
		int minl = Integer.MAX_VALUE;

		boolean isLap = rd -ld > 0;
		if( lm == 0 || rm==0 || isLap ) {
			minl = 0;
		}else {
			for( int i=lm ; i<= rm ; i++ ) {
				for( int j=lm+1 ; j<= rm ; j++ ) {
					int tmp=(i*j)%m;
					if(  minl > tmp ) {
						minl = tmp;
					}
				}
			}
		}

		System.out.println(minl);
	}
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)
#define INF 1000000000
#define MOD 1000000007
typedef  long long ll;
using namespace std;

ll conv(ll n,ll r){
    if(r == 0 || n==r){
        return 1;
    }
    return conv(n-1,r)+conv(n-1,r-1);
}

int a[15][29];

void solve(void){
    ll l,r;
    cin >> l >> r;
    ll la = l%2019;
    ll ra = r%2019;
    bool flag = false;
    ll l3 = l/3,r3 = r/3;
    ll l673 = l/673,r673 = r/673;
    if( r3-l3 > 0 && r673-l673>0) flag = true;
    ll ans = 1000000;
    ll tmp;
    if(flag){
        cout << 0 << endl;
    }else{
        for(int i = la;i < ra;i++){
            for(int j = i+1;j < ra+1;j++){
                tmp = i*j%2019;
                ans = min(ans,tmp);
            }
        }
        cout << ans << endl;
    }

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int A,B,m=INT_MAX;
    cin>>A>>B;
    vector<long long int>v,v1;
    if((B-A)>=672){
        cout<<0<<endl;
    }else{

   for(long long int i=A;i<=B;i++ ){
       for(long long int j=i+1;j<=B;j++){
            m=min(m,(i*j)%2019);
       }
   }
   cout<<m%2019<<endl;
   }

}


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

int main(void) {
    ll L, R;
    cin >> L >> R;

    ll ans = 2018;
    for(ll i=L;i<=R;i++) {
        for(ll j=i+1;j<=R;j++) {
            ans = min(ans, (i*j)%2019);
            if(ans==0) {
                cout << ans << endl;
                return 0;
            }
        }
    }

    cout << ans << endl;

    return (0);
}


#include <bits/stdc++.h>
using namespace std;
#define BE(x) x.begin(), x.end()

int main() {
    long long l, r;
    cin >> l >> r;

    long long ans = 2019;
    int icnt = 0;
    for (long long i = l; i < r; i++) {
        int jcnt = 0;
        for (long long j = i+1; i <= r; i++) {
            ans = min(ans, i*j%2019);
            jcnt++;
            if (jcnt == 2020) break;
        }
        icnt++;
        if (icnt == 2020) break;
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define BE(x) x.begin(), x.end()

int main() {
    long long l, r;
    cin >> l >> r;

    long long ans = 2019;
    int icnt = 0;
    for (long long i = l; i < r; i++) {
        int jcnt = 0;
        for (long long j = i+1; i <= r; i++) {
            ans = min(ans, i*j%2019);
            jcnt++;
            if (jcnt == 2019) break;
        }
        icnt++;
        if (icnt == 2019) break;
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define BE(x) x.begin(), x.end()

int main() {
    long long l, r;
    cin >> l >> r;

    int ans = 2019, icnt = 0;
    for (int i = l; i < r; i++) {
        int jcnt = 0;
        for (int j = i+1; i <= r; i++) {
            ans = min (ans, i*j%2019);
            jcnt++;
            if (jcnt == 2019) break;
        }
        icnt++;
        if (icnt == 2019) break;
    }
    cout << ans << endl;
}


#include<stdio.h>

int main(void)
{
  long long min=10000;
  long long l,r;
  scanf("%lld %lld",&l,&r);

  for(long long i=l;i<r;i++){
    for(long long j=l+1;j<=r;j++){

      if((i*j)%2019==0&&i<j){
        puts("0");
        return 0;
      }
      if((i*j)%2019<min&&i<j){
        min=(i*j)%2019;
      }
    }
  }

  printf("%lld\n",min);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max(a,b)-min(a,b))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
void initialize(){

}
int main(void){
  initialize();
  ll n,m,i,j,l,r,result=-1;
  int a[LIMIT2]={0};
  char s[LIMIT1];

  scanf("%lld %lld",&l,&r);
  for(i=l;i<r;i++){
    for(j=i+1;j<=r;j++){
      if(result==-1) result = (i*j)%2019;
      else result = min(result, (i*j)%2019);

      if(result==0) break;
    }
    if(result==0) break;
  }
  printf("%lld", result);

  return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){

  long long i,j;
  long long min = 10000000;
  long long l,r;

  scanf("%lld %lld", &l, &r);

  for(i = l;i <= r;i++){
    for(j = l;j < i;j++){
      if(min > (i*j) % 2019) min = (i*j) % 2019;

      if(min == 0){
        printf("0\n");
        return 0;
      }
    }
  }

  printf("%lld\n", min);
  return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int min(int a, int b){
    if(a > b) return b;
    else return a;
}

const int inf = 1012345678;
int main(){
    ll l, r;

    scanf("%lld %lld", &l, &r);

    int min = 2018;
    if((r - l) >= 2019){
        min = 0;
    }else{
        for(int i = l; i < r; ++i){
            for(int j = i + 1; j <= r; ++j){
                if(((i * j) % 2019) < min){
                    min = (i * j) % 2019;
                }
            }
        }
    }

    printf("%d\n", min);

    return 0;
}


#include<stdio.h>

int main(){
	long long int l,r,i,j,amari = 2018;
	scanf("%lld %lld",&l,&r);
	for(i = l; i < r; i++){
		if( (i * (i + 1) % 2019) < amari){
			amari = i * (i + 1) % 2019;
		}
	}
	printf("%lld",amari);
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}

int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  |
\****************************************/

int main(void){
  int l,r;
  scanf("%d%d",&l,&r);

  if(r-l>2020){
    printf("0\n");
    return 0;
  }

  int ans=3000;
  for(int i=l;i<r;i++){
    for(int j=i+1;j<=r;j++){

      int now=i%2019*j%2019;

      chmin(&ans,now);
    }
  }

  printf("%d\n",ans);

  return 0;
}


'use strict'
function main(i) {
  i = i.trim().split(' ')
  const Y = 2019
  const R = Number(i[1])
  const L = Number(i[0])
  let ans = Y - 1;

  if (L * R > Y){
    if (R - L < Y) {
      const LY = L % Y;
      const RY = R % Y;

      for(let i = LY; i < RY; i++){
        for(let j = i + 1; j <= RY; j++){
          let n = (i * j) % Y
          if (n < ans) ans = n
          if (ans === 0) break
        }
        if (ans === 0) break
      }
	    console.log(ans);
    } else {
      console.log(0);
    }
  } else {
    console.log(L * (L+1));
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function Main(input) {
  var L = parseInt(input.split(" ")[0]);
  var R = parseInt(input.split(" ")[1]);
  var min = 2019;
  if((R - L) >= 2019){
     console.log(0);
    	return;
     }
  L = L % 2019;
  R = R % 2019;
  for(var i = L; i < R; i++){
    if(i % 2019 == 0){
       console.log(0);
    	return;
    }
    for(var j = i + 1; j <= R; j++){
      if(j % 2019 == 0){
         console.log(0);
    	return;
         }
      var cal = (i * j) % 2019;
      if(min > cal){
         min = cal;
        if(min == 0){
           console.log(min);
          return;
           }
      }
    }
  }
  console.log(min);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const main = (inputs) => {
  var TW = 2019;
  var L = inputs[0].split(" ")[0]-0;
  var R = inputs[0].split(" ")[1]-0;
  var mods = [];
  var thflg = false;  // 3
  var mnsflg = false; // 673
  for(var i=L;i<=R;i++){
    var val = i%TW;
    mods.push(i);
    if(val == 0){
      console.log(0);
      return;
    }else if(val == 3){
      thflg = true;
    }else if(val == 673){
      mnsflg = true;
    }
    if(thflg && mnsflg){
      console.log(0);
      return;
    }
  }
  var ans = TW;
  for(var i=0;i<mods.length;i++)
  for(var j=i+1;j<mods.length;j++){
    ans = Math.min(ans, ((mods[i]%TW)*(mods[j]%TW))%TW);
  }
  console.log(ans);

}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));


function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const L=input[0].split(' ')[0]-0;
  const R=input[0].split(' ')[1]-0;
  if(R-L>3000){
    console.log(0);
    return;
  }
  var ans=Infinity;
  for(var i=L;i<R;i++){
    for(var j=i+1;j<=R;j++){
      ans=Math.min(ans,i*j%2019);
    }
  }
  console.log(ans);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const L=input[0].split(' ')[0]-0;
  const R=input[0].split(' ')[1]-0;
  var min=L%2019;
  var max=R%2019;
  if(max<=min){
    max+=2019;
  }
  var ans=Infinity;
  for(var i=min;i<max;i++){
    for(var j=i+1;j<=max;j++){
      ans=Math.min(ans,i*j%2019);
    }
  }
  console.log(ans);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [L, R] = nextIntArray()
    let min = 2018
    for(let i = L; i<R; i++){
        for(let j = i+1; j<=R; j++){
            let div = i*j%2019
            if(div == 0){
                console.log(0)
                return
            }
            min = Math.min(min, div)
        }
    }
    console.log(min)
}
Main()


package main

import "fmt"

func main() {
	var l, r int
	fmt.Scan(&l, &r)

	var min int
	ans := 9999

	for i := l; i < r; i++ {
		for j := i + 1; j <= r; j++ {
			min = i * j % 2019
			if min < ans {
				ans = min
				if ans == 0 {
					break
				}
			}
		}
		if ans == 0 {
			break
		}
	}

	fmt.Println(ans)
}


package main

import "fmt"

func main() {
	var l, r int
	fmt.Scan(&l, &r)

	var min int
	ans := 2020

	for i := l; i < r; i++ {
		for j := i + 1; j <= r; j++ {
			min = i * j % 2019
			if min < ans {
				ans = min
			}
			if min == 0 {
				fmt.Println(0)
				return
			}
		}
	}

	fmt.Println(ans)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
	"strings"
	// "regexp"
)

/* sort */
type pair struct {
	index  int64
	p1, p2 interface{}
}
type pairs []pair

func (slice pairs) Len() int {
	return len(slice)
}

func (slice pairs) Less(i, j int) bool {
	return slice[i].index < slice[j].index
}

func (slice pairs) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

/* sort */
type Int64Slice []int64

func (slice Int64Slice) Len() int {
	return len(slice)
}

func (slice Int64Slice) Less(i, j int) bool {
	return slice[i] < slice[j]
}

func (slice Int64Slice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func Int64s(a []int64)                    { sort.Sort(Int64Slice(a)) }
func Int64sSliceAreSorted(a []int64) bool { return sort.IsSorted(Int64Slice(a)) }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	di      = []int64{-1, 0, 1, 0}
	dj      = []int64{0, -1, 0, 1}
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)
	L, R := readInt(), readInt()
	// zero case
	// minval case
	var cases []int64
	for i := L; i < L+2019; i++ {
		cases = append(cases, i%2019)
		if i == R {
			break
		}
	}
	min := int64(INF)
	for i := 0; i < len(cases); i++ {
		for j := i + 1; j < len(cases); j++ {
			v := cases[i] * cases[j] % 2019
			if min > v {
				min = v
			}
		}
		if min == 0 {
			break
		}
	}
	fmt.Println(min)
}

/*==========================================
 *             Library
 *==========================================*/
func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}
func doubleAry(h int64, w int64, init int64) (res [][]int64) {
	res = make([][]int64, h)
	for i := int64(0); i < h; i++ {
		res[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			res[i][j] = init
		}
	}
	return
}

func aryEq(a []int64, b []int64) bool {
	return reflect.DeepEqual(a, b)
}

func clone(n []int64) (r []int64) {
	r = make([]int64, len(n))
	for i := 0; i < len(n); i++ {
		r[i] = n[i]
	}
	return
}
func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

// scanner.Split(bufio.ScanWords) をコメントアウトしないと使用不可
func readLine() (s string) {
	if scanner.Scan() {
		s = scanner.Text()
	}
	return s
}

func readInt() (read int64) {
	scanner.Scan()
	read, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return
}

func readFloat() (read float64) {
	scanner.Scan()
	read, err := strconv.ParseFloat(scanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return
}

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func readString() (read string) {
	scanner.Scan()
	read = scanner.Text()
	return
}

func readStrings() (read []string) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, string(v))
	}
	return
}

func s2i(s string) int64 {
	var intVal, e = strconv.ParseInt(s, 10, 64)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int64) string {
	var strVal = strconv.FormatInt(i, 10)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func abs(i int64) int64 {
	return int64(math.Abs(float64(i)))
}

func sum(i []int64) int64 {
	sum := int64(0)
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int64 {
	var ret = make([]int64, 0, len(strs))
	for _, str := range strs {
		var intVal = s2i(str)
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int64) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = i2s(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

func reverse(res []int64) []int64 {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}
func reverseStr(res []string) []string {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}

func ini(res []int64, init int64) {
	if len(res) == 0 {
		return
	}
	res[0] = init
	for i := 0; i < len(res); i++ {
		copy(res[i:], res[:i])
	}
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	L, R := ReadInt(), ReadInt()
	if R-L+1 >= 2019 {
		fmt.Println(0)
		return
	}
	if L%2019 > R%2019 {
		fmt.Println(0)
		return
	}

	min := 2018
	for i := L % 2019; i < R%2019; i++ {
		v := (i * (i + 1)) % 2019
		if v < min {
			min = v
		}
	}
	fmt.Println(min)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	L, R := ReadInt(), ReadInt()
	if R-L+1 >= 2019 {
		fmt.Println(0)
		return
	}
	if L%2019 < R%2019 {
		L %= 2019
		fmt.Println((L * (L + 1)) % 2019)
	} else {
		fmt.Println(0)
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	L, R := ReadInt(), ReadInt()
	if R-L+1 >= 2019 {
		fmt.Println(0)
		return
	}
	if L%2019 < R%2019 {
		fmt.Println(L * (L + 1) % 2019)
	} else {
		fmt.Println(0)
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


l, r = gets.split.map(&:to_i)

ans = 2018
zero_divided = false

l.upto(r - 1) do |i|
  if zero_divided
    ans = 0
    break
  end

  (i + 1).upto(r) do |j|
    p = i * j % 2019

    if p == 0
      zero_divided = true
      break
    end

    ans = p if p <= ans
  end
end

puts ans


L,R = gets.split.map &:to_i
r = [R, L + 2019].min

min = 2019
L.upto(r-1) do |i|
  (i+1).upto(r) do |j|
    a = (i*j)%2019
    if a == 0
      puts 0
      exit
    end
    if a < min
      min = a
    end
  end
end

puts min


l,r = gets.split.map(&:to_i)
min = 2019
(l...r).each do |i|
    (i + 1..r).each do |j|
      mod = (i*j) % 2019
      if mod == 0
        p 0
        exit
      elsif mod < min
        min = mod
      end
    end
end
puts min


left, right = gets.chomp.split.map(&:to_i)

if right - left >= 2019 then
    puts 0
else
    res = 114514
    (left..right).each do |i|
        tmp = i % 2019
        res = tmp if tmp < res
    end
    puts res * (res+1)
end


x,y=gets.split.map &:to_i
sum=[]
mai=[]
if (x-y).abs>=4038
  puts 0
else
  for i in x..y
    sum << [i%2019,2019-i%2019].min
    mai << i
  end
  ans=sum.zip(mai).sort
  puts (ans[0][1]*ans[1][1])%2019
end


x,y=gets.split.map &:to_i
sum=[]
mai=[]
if (x-y).abs>=4038
  puts 0
else
  for i in x..y
    sum << i%2019
    mai << i
  end
  ans=sum.zip(mai).sort
  puts (ans[0][1]*ans[1][1])%2019
end


fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}
const NUM: usize = 2019;
fn main() {
    let lr = read_vec::<usize>();
    let (l, r) = (lr[0], lr[1]);

    let mut ans = NUM;
    'outer: for i in l..r {
        for j in i+1..r+1 {
            ans = std::cmp::min(i * j % NUM, ans);
            if ans == 0 {
                break 'outer;
            }
        }
    }

    println!("{}", ans);
}


use std::io;
use std::cmp;

fn main() {
    let (l, r) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let mut ans: usize = std::usize::MAX;
    'outer: for i in l..r + 1 { for j in (i + 1)..r + 1 {
        ans = cmp::min(ans, (i * j) % 2019);
        if ans == 0 { break 'outer; }
    }}

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}


use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let l: usize = iter.next().unwrap().parse().unwrap();
    let r: usize = iter.next().unwrap().parse().unwrap();

    let mut ans = std::usize::MAX;
    for i in l..r + 1 {
        for j in i + 1..r + 1 {
            ans = std::cmp::min(ans, i % 2019 * j % 2019);
            if ans == 0 {
                break;
            }
        }
        if ans == 0 {
            break;
        }
    }
    println!("{}", ans);
}


#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use std::str::FromStr;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

pub struct Scanner {
    buf: std::collections::VecDeque<String>,
}
impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: std::collections::VecDeque::new(),
        }
    }
    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }
            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }
    pub fn next<T: FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }
    pub fn next_usize(&mut self) -> usize {
        self.next()
    }
    pub fn next_isize(&mut self) -> isize {
        self.next()
    }
    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }
    pub fn next_string(&mut self) -> String {
        self.next()
    }
    pub fn next_char(&mut self) -> char {
        self.next()
    }
    pub fn next_float(&mut self) -> f64 {
        self.next()
    }
}
fn main() {
    let mut sc = Scanner::new();
    let l = sc.next_usize();
    let r = sc.next_usize();

    let mut min = U_INF;
    let mut max = 0;

    for i in l..=r {
        min = (min).min(i % 2019);
        max = (max).max(i % 2019);
    }

    let mut ans = U_INF;
    for i in min..=max {
        for j in min..=max {
            if i != j {
                ans = (ans).min((i * j) % 2019);
            }
        }
    }

    println!("{}", ans);
}


// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        l: u32,
        r: u32,
    }

    if r - l >= 2019 || l % 2019 >= r % 2019 {
        println!("0");
    }else {
        let mut three_x = false;
        let mut three_2x = false;
        let mut sst_x = false;
        let mut sst_2x = false;
        for i in l..r + 1 {
            if i % 6 == 0 {
                three_2x = true;
            } else if i % 3 == 0 {
                three_x = true;
            } else if i % 1346 == 0 {
                sst_2x = true;
            } else if i % 673 == 0 {
                sst_x = true;
            }
            if (three_x && sst_x) || (three_2x && sst_2x) {
                println!("0");
                return;
            }
        }
        println!("{}", ((l % 2019) * ((l + 1) % 2019)) % 2019);
    }
}


// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        l: u32,
        r: u32,
    }

    if r - l >= 2019 || l % 2019 >= r % 2019 {
        println!("0");
    }else {
        let mut three_x = false;
        let mut sst_x = false;
        for i in l..r + 1 {
            if i % 3 == 0 {
                three_x = true;
            } else if i % 673 == 0 {
                sst_x = true;
            }
            if three_x && sst_x {
                println!("0");
                return;
            }
        }
        println!("{}", ((l % 2019) * ((l + 1) % 2019)) % 2019);
    }
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let lr = readInts()
    let(l, r) = (lr[0], lr[1])
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力

    if abs(l - r) >= 2019 {
        print(0)
        return
    }

    var ans = 2018
    for left in l..<r {
        for right in left + 1...r {
            if left >= right {
                break
            }
            ans = min(left * right % 2019, ans)
        }
    }
    print(ans)
}
main()


let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (L, R) = (input[0], input[1])
var ans = 2019
loop: for i in L..<R {
  for j in i+1...R {
    ans = min((i*j)%2019, ans)
    if ans == 0 {
      break loop
    }
  }
}
print(ans)


//
//  main.swift
//
//  Created by sun-yryr
//  Copyright © 2019 sun-yryr. All rights reserved.
//

import Foundation

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) {return (a[0], a[1])}
prefix func * <T> (a: [T]) -> (T, T, T) {return (a[0], a[1], a[2])}

func readInt(separator s: Character = " ") -> [Int] {return readLine()!.split(separator: s).map({Int($0)!})}
func readDouble(separator s: Character = " ") -> [Double] {return readLine()!.split(separator: s).map({Double($0)!})}
func readElement(separator s: Character = " ") -> [String] {return readLine()!.split(separator: s).map({String($0)})}

extension String {
    func at(_ i: Int) -> Character {
        precondition(0 <= i && i < self.count)
        return self[self.index(self.startIndex, offsetBy: i)]
    }
}

func main() {
    let (L, R) = *readInt()
    if ((R-L) >= 2019) {
        print(0)
    } else {
        var mins = 2019
        for i in L..<R {
            for j in (i+1)...R {
                mins = min(mins, (i * j) % 2019)
            }
        }
        print(mins)
    }
}
main()


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let lr = readInts()
    let(l, _) = (lr[0], lr[1])

    print((l + 1) * l % 2019)
}
main()


//
//  main.swift
//
//  Created by sun-yryr
//  Copyright © 2019 sun-yryr. All rights reserved.
//

import Foundation

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) {return (a[0], a[1])}
prefix func * <T> (a: [T]) -> (T, T, T) {return (a[0], a[1], a[2])}

func readInt(separator s: Character = " ") -> [Int] {return readLine()!.split(separator: s).map({Int($0)!})}
func readDouble(separator s: Character = " ") -> [Double] {return readLine()!.split(separator: s).map({Double($0)!})}
func readElement(separator s: Character = " ") -> [String] {return readLine()!.split(separator: s).map({String($0)})}

extension String {
    func at(_ i: Int) -> Character {
        precondition(0 <= i && i < self.count)
        return self[self.index(self.startIndex, offsetBy: i)]
    }
}

func main() {
    let (L, R) = *readInt()

    var mins = 2019
    for i in L..<R {
      for j in (i+1)...R {
        mins = min(mins, (i * j) % 2019)
      }
    }
    print(mins)
}
main()


//
//  main.swift
//
//  Created by sun-yryr
//  Copyright © 2019 sun-yryr. All rights reserved.
//

import Foundation

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) {return (a[0], a[1])}
prefix func * <T> (a: [T]) -> (T, T, T) {return (a[0], a[1], a[2])}

func readInt(separator s: Character = " ") -> [Int] {return readLine()!.split(separator: s).map({Int($0)!})}
func readDouble(separator s: Character = " ") -> [Double] {return readLine()!.split(separator: s).map({Double($0)!})}
func readElement(separator s: Character = " ") -> [String] {return readLine()!.split(separator: s).map({String($0)})}

extension String {
    func at(_ i: Int) -> Character {
        precondition(0 <= i && i < self.count)
        return self[self.index(self.startIndex, offsetBy: i)]
    }
}

func main() {
    let (L, R) = *readInt()
    if ((R-L) >= 2019) {
        print(0)
    } else {
        var mins = 20000
        for i in L..<R {
            for j in (i+1)...R {
                mins = min(mins, (i * j) % 2019)
            }
        }
    }
}
main()


export class Main {
  static main(input): string {
    const [l, r]: number[] = input.split("\n")[0].split(" ").map(a => parseInt(a));
    const range = [];
    if (r - l >= 2019) {
      return "0";
    } else {
      for (let i = l; i <= r; i++) {
        range.push(i % 2019);
      }
    }
    let min = Infinity;
    for (let i = 0, len = range.length; i < len - 1; ++i) {
      for (let j = i + 1; j < len; ++j) {
        const p: number = (range[i] * range[j]) % 2019;
        if (p < min) {
          min = p;
        }
      }
    }
    return `${min}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


'use strict'
const main = (input: string) => {
    // 解説読みました
    const [l, r] = input.trim().split(' ').map(Number)
    const lmod = l % 2019
    const rmod = r % 2019
    if (r - l >= 2018) return console.log(0)
    let result = Infinity
    for (let i = lmod; i < rmod; i++) {
        for (let j = i+1; j <= rmod; j++) {
            result = Math.min(result, (i*j) % 2019)
        }
    }
    console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


const stdin = require('fs')
  .readFileSync('/dev/stdin', 'utf8')
  .trim()

const [l, r] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const ans = () => {
  if (r - l >= 2019) {
    return 0
  } else {
    let min = Infinity
    for (let i = l; i < r; i++) {
      for (let j = i + 1; j <= r; j++) {
        if (i !== j) {
          const mod = ((i % 2019) * (j % 2019)) % 2019

          min = Math.min(min, mod)
        }
      }
    }

    return min
  }
}

console.log(ans())


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let [l,r]=tnn(2),n=2019
  if(r-l>=2019){
    to(0)
    return
  }
  l=l%n
  r=r%n
  if(r<=l){
    to(0)
    return
  }
  to(r*(r+1)%n)
}
main()


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let [l,r]=tnn(2),n=2019
  let m=l%n,m_i=l
  if(r-l>=2019){
    to(0)
    return
  }
  for(let i=l;i<=r;i++){
    if(m>i%n){
      m=i%n
      m_i=i
      if(m==0){to(0);return}
    }
  }
  l=m_i
  r=l+1
  to((l%n)*(r%n)%n)
}
main()


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let [l,r]=tnn(2),n=2019
  let m=l%n,m_i=l
  for(let i=r;i>=l;i--){
    if(m>i%n){
      m=i%n
      m_i=i
      if(m==0)break
    }
  }
  l=m_i
  r=l+1
  to((l%n)*(r%n)%n)
}
main()


# tenka1-2019-beginnerC - Stones
def main():
    N, S = open(0).read().split()
    ans, blk = 0, 0
    for i in S:
        if i == "#":
            blk += 1
        else:
            if blk:
                ans += 1
                blk -= 1
    print(ans)

if __name__ == "__main__":
    main()


import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
    n = II()
    s = IS()
    cnt_b = 0
    cnt_w = s.count('.')
    cnt = cnt_w
    for si in s:
        if si == '#':
            cnt_b += 1
        else:
            cnt_w -= 1
        c = cnt_b+cnt_w
        if c < cnt:
            cnt = c
    print(cnt)

if __name__ == '__main__':
    main()


def C(N, S):
    n_diff_chars = S.count(".")
    cand_list = [n_diff_chars]
    for c in S:
        if c == ".":
            n_diff_chars -= 1
        else:
            n_diff_chars += 1
        cand_list.append(n_diff_chars)
    print(min(cand_list))

if __name__ == "__main__":
    N = int(input())
    S = input()
    C(N, S)


N = int(input())
stones = input()

w_cnt = stones.count('.')
b_cnt = N-w_cnt
first_bi = max(0, stones.find('#'))
last_wi = max(0, stones.rfind('.'))
pw_cnt = stones[first_bi:].count('.')
pb_cnt = stones[:last_wi].count('#')

print(min(w_cnt, b_cnt, pw_cnt, pb_cnt))


n = int(input())
s = input()
ans = 0
init = True
for i in range(n):
    if (not init) and s[i] == '#':
        ans -= 1
    if init and s[i] == '#':
        ans = n - i - 1
        init = False
cnt = 0
for c in s[::-1]:
    if c == '.':
        break
    cnt += 1
ans = min(ans, s.count('#') - cnt)
print(ans)


n = int(input())
s = input()
ans = 0
init = True
for i in range(n):
    if (not init) and s[i] == '#':
        ans -= 1
    if init and s[i] == '#':
        ans = n - i - 1
        init = False
print(ans)


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

public class Main {
	static void solve() {
		int n = ni();
		char s[] = ns(n);
		int ans = inf;

		int cnt[] = new int[n+1];
		for(int i=0;i<n;i++) {
			cnt[i+1] = cnt[i] + (s[i]=='#'?1:0);
		}
		for(int i=0;i<=n;i++) {
			int black = (n - i) - (cnt[n] - cnt[i]);
			int white = cnt[i];
			ans = min(ans, black + white);
		}
		out.println(ans);
	}

	//constant
	static final long mod = (long) 1e9 + 7;
	static final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
	static final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final int inf = Integer.MAX_VALUE / 2;
	static final long linf = Long.MAX_VALUE / 3;
	static final double dinf = Double.MAX_VALUE / 3;
	static final double eps = 1e-10;
	static final double pi = Math.PI;
	static StringBuilder sb = new StringBuilder();
	static InputStream is;
	static PrintWriter out;
	static String INPUT = "";

	//libraries
	static void reverse(int ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void reverse(long ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void reverse(double ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void reverse(char ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static String getReverse(String s) {
		char c[] = s.toCharArray();
		reverse(c);
		s = String.valueOf(c);
		return s;
	}

	static <T> void reverse(List<T> ls) {
		int sz = ls.size();
		for (int i = 0; i < sz / 2; i++) {
			T t = ls.get(i);
			ls.set(i, ls.get(sz - 1 - i));
			ls.set(sz - 1 - i, t);
		}
	}

	static <T> void reverse(T[] ar) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			T t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void sbnl() {//StringBuilderに改行文字をappendする
		sb.append("\n");
	}

	static int lowerBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int lowerBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int lowerBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int lowerBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static <T> int lowerBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static <T> int upperBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static <T> int rupperBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static <T> int rlowerBound(List<T> ls, T x) {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static int[] concat(int x, int arr[]) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}

	static int[] concat(int arr[], int x) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}

	static long[] concat(long x, long arr[]) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}

	static long[] concat(long arr[], long x) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}

	static int max(int x, int y) {
		return Math.max(x, y);
	}

	static int min(int x, int y) {
		return Math.min(x, y);
	}

	static int max(int x, int y, int z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}

	static int min(int x, int y, int z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}

	static long max(long x, long y) {
		return Math.max(x, y);
	}

	static long min(long x, long y) {
		return Math.min(x, y);
	}

	static long max(long x, long y, long z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}

	static long min(long x, long y, long z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}

	static double max(double x, double y) {
		return Math.max(x, y);
	}

	static double min(double x, double y) {
		return Math.min(x, y);
	}

	static double max(double x, double y, double z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}

	static double min(double x, double y, double z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}

	static void sort(int[] ar) {
		Arrays.sort(ar);
	}

	static void sort(long[] ar) {
		Arrays.sort(ar);
	}

	static void sort(double[] ar) {
		Arrays.sort(ar);
	}

	static void sort(char[] ar) {
		Arrays.sort(ar);
	}

	static void rsort(int[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void rsort(long[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void rsort(double[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void rsort(char[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void fill(int arr[], int x) {
		Arrays.fill(arr, x);
	}

	static void fill(long arr[], long x) {
		Arrays.fill(arr, x);
	}

	static void fill(boolean arr[], boolean x) {
		Arrays.fill(arr, x);
	}

	static void fill(double arr[], double x) {
		Arrays.fill(arr, x);
	}

	static void fill(int arr[][], int x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	static void fill(long arr[][], long x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	static void fill(double arr[][], double x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	static void fill(boolean arr[][], boolean x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	//MOD culc
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}

	public static void main(String[] args) throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	//input
	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;

	private static int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private static boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private static int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	@SuppressWarnings("unused")
	private static double nd() {
		return Double.parseDouble(ns());
	}

	@SuppressWarnings("unused")
	private static char nc() {
		return (char) skip();
	}

	private static String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private static char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	@SuppressWarnings("unused")
	private static char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	@SuppressWarnings("unused")
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	@SuppressWarnings("unused")
	private static long[] nla(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private static int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	@SuppressWarnings("unused")
	private static long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		String S = sc.next();
		char[] c = new char[N + 2];
		c[0] = ' ';
		c[N + 1] = ' ';
		for (int i = 1; i <= N; i++) {
			c[i] = S.charAt(i - 1);
		}
		int left = 0;
		int right = 0;
		int count = left + right;
		for (int i = 1; i <= N; i++) {
			if (c[i] == '.')
				right++;
		}

		int min = Integer.MAX_VALUE;

		for (int i = 0; i <= N + 1; i++) {
			if (c[i] == '#')
				left++;
			if (c[i] == '.')
				right--;
			count = left + right;
			min = Math.min(min, count);
		}

		System.out.println(min);

	}

	//以下、自作ライブラリ

	/*
		int N = sc.nextInt();

		int[] a = new int[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.nextInt();

		String s = sc.next();

		String[] a = new String[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.next();

		int[][] a = new int[N][2];
		for (int i = 0; i < N; i++) {
			a[i][0] = sc.nextInt();
			a[i][1] = sc.nextInt();
		}
		Arrays.sort(a, (x, y) -> Integer.compare(x[0], y[0]));

		List<Integer> list = new ArrayList<>();

		Set<Integer> set = new HashSet<>();

		Map<Integer, Integer> map = new HashMap<>();
	 */

	//階乗
	public static int fact(int n) {
		if (n == 1 || n == 0)
			return 1;
		else
			return n * fact(n - 1);
	}

	//指定した値以上の要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long lowerBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] < y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//指定した値より大きい要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long upperBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] <= y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	private static final long MOD = 1000000007;
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {

		int n = ni();
		char[] a = ns().toCharArray();
		int cnt1 = 0;
		int ans = 0;
		for (int i = n - 1; i >= 0; i--)
			if (a[i] == '.')
				cnt1++;
			else {
				// keep as black
				ans = Math.min(1 + ans, cnt1);
				// change to 1
			}

		System.out.println(ans);
	}

	StringBuffer sb = new StringBuffer();

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		Thread t = new Thread(null, null, "~", Runtime.getRuntime().maxMemory()) {
			@Override
			public void run() {
				long s = System.currentTimeMillis();
				solve();
				out.flush();
				if (!INPUT.isEmpty())
					tr(System.currentTimeMillis() - s + "ms");
			}
		};
		t.start();
		t.join();

		// long s = System.currentTimeMillis();
		// solve();
		// out.flush();
		// if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

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

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int[][] na(int n, int m) {
		int[][] a = new int[n][];
		for (int i = 0; i < n; i++)
			a[i] = na(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}