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

int main() {
		int n , x ,y;
		cin >> n >> x >> y;
		string s;
		cin >> s ;
		int a = s[x-1] - '0';
		int b = s[y-1] - '0';
		
		if(a%b == 0 || b%a == 0 )
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
 		}
	return 0;
}