#include <bits/stdc++.h>   #pragma GCC optimize( Ofast ,  inline ,  -ffast-math )   #pragma GCC target( avx,sse2,sse3,sse4,mmx )   inline long long read() {     long long s(0);     bool w(1);     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) s = s * 10 + ch -  0 , ch = getchar();     return s * w;   }   long long l, r, n, m, x, y, num;   int main() {     n = read(), x = read();     for (int i = 1; i <= n; i++) {       num = read();       l = l * x + num;     }     scanf( %lld%lld , &m, &y);     for (int i = 1; i <= m; i++) {       num = read();       r = r * y + num;     }     puts(l == r ?  =  : (l > r ?  >  :  < ));   }   