#include <iostream>
#include <cstring>
using namespace std;
int main() {
char str[100001], substr1[100001], substr2[100001];
cin >> str;
int q, l1, r1, l2, r2;
cin >> q;
while (q--) {
cin >> l1 >> r1 >> l2 >> r2;
strncpy(substr1, &str[l1 - 1], r1 - l1 + 1);
strncpy(substr2, &str[l2 - 1], r2 - l2 + 1);
cout <<( strcmp(substr1,substr2) == 0 ? '+': '-');
memset(substr1, 0, sizeof(substr1)/sizeof(substr1[0]));
memset(substr2, 0, sizeof(substr2)/sizeof(substr2[0]));
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoJY2hhciBzdHJbMTAwMDAxXSwgc3Vic3RyMVsxMDAwMDFdLCBzdWJzdHIyWzEwMDAwMV07CgljaW4gPj4gc3RyOwoJaW50IHEsIGwxLCByMSwgbDIsIHIyOwoJY2luID4+IHE7Cgl3aGlsZSAocS0tKSB7CgkJY2luID4+IGwxID4+IHIxID4+IGwyID4+IHIyOwoJCXN0cm5jcHkoc3Vic3RyMSwgJnN0cltsMSAtIDFdLCByMSAtIGwxICsgMSk7CgkJc3RybmNweShzdWJzdHIyLCAmc3RyW2wyIC0gMV0sIHIyIC0gbDIgKyAxKTsKCQljb3V0IDw8KCBzdHJjbXAoc3Vic3RyMSxzdWJzdHIyKSA9PSAwID8gJysnOiAnLScpOwoJCW1lbXNldChzdWJzdHIxLCAwLCBzaXplb2Yoc3Vic3RyMSkvc2l6ZW9mKHN1YnN0cjFbMF0pKTsKCQltZW1zZXQoc3Vic3RyMiwgMCwgc2l6ZW9mKHN1YnN0cjIpL3NpemVvZihzdWJzdHIyWzBdKSk7CgkJCgl9CglyZXR1cm4gMDsKfQ==