summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-06-18 18:16:02 +0300
committerHarald Welte <laforge@gnumonks.org>2017-07-10 23:42:02 +0200
commit1389e86d116509884b0e5ee3421fe7683afcab9b (patch)
tree52ef42f5f49ac3ae52e687cbc7207426fd11e075
parent548e3712009f68f801be806884d848b47c30dced (diff)
Add pseudo-random bit sequence generator to libosmcoore
These PRBS sequences are specified in ITU-T O.150. They are typically used as test data to be transmitted for BER (bit error rate) testing. Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
-rw-r--r--include/Makefile.am1
-rw-r--r--include/osmocom/core/prbs.h25
-rw-r--r--src/Makefile.am2
-rw-r--r--src/prbs.c74
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/prbs/prbs_test.c47
-rw-r--r--tests/prbs/prbs_test.ok16
-rw-r--r--tests/testsuite.at6
8 files changed, 175 insertions, 3 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index e0c1a2bd..4e92d553 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -31,6 +31,7 @@ nobase_include_HEADERS = \
osmocom/core/macaddr.h \
osmocom/core/msgb.h \
osmocom/core/panic.h \
+ osmocom/core/prbs.h \
osmocom/core/prim.h \
osmocom/core/process.h \
osmocom/core/rate_ctr.h \
diff --git a/include/osmocom/core/prbs.h b/include/osmocom/core/prbs.h
new file mode 100644
index 00000000..aaca17d9
--- /dev/null
+++ b/include/osmocom/core/prbs.h
@@ -0,0 +1,25 @@
+#pragma once
+#include <stdint.h>
+#include <osmocom/core/bits.h>
+
+/*! \brief definition of a PRBS sequence */
+struct osmo_prbs {
+ const char *name; /*!< human-readable name */
+ unsigned int len; /*!< length in bits */
+ uint64_t coeff; /*!< coefficients */
+};
+
+/*! \brief state of a given PRBS sequence generator */
+struct osmo_prbs_state {
+ const struct osmo_prbs *prbs;
+ uint64_t state;
+};
+
+extern const struct osmo_prbs osmo_prbs7;
+extern const struct osmo_prbs osmo_prbs9;
+extern const struct osmo_prbs osmo_prbs11;
+extern const struct osmo_prbs osmo_prbs15;
+
+void osmo_prbs_state_init(struct osmo_prbs_state *st, const struct osmo_prbs *prbs);
+ubit_t osmo_prbs_get_ubit(struct osmo_prbs_state *state);
+int osmo_prbs_get_ubits(ubit_t *out, unsigned int out_len, struct osmo_prbs_state *state);
diff --git a/src/Makefile.am b/src/Makefile.am
index d8fcecac..8e7ef4b4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,7 @@ libosmocore_la_SOURCES = timer.c timer_gettimeofday.c select.c signal.c msgb.c b
conv.c application.c rbtree.c strrb.c \
loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \
macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
- conv_acc.c conv_acc_generic.c sercomm.c
+ conv_acc.c conv_acc_generic.c sercomm.c prbs.c
if HAVE_SSE3
libosmocore_la_SOURCES += conv_acc_sse.c
diff --git a/src/prbs.c b/src/prbs.c
new file mode 100644
index 00000000..be52fd4c
--- /dev/null
+++ b/src/prbs.c
@@ -0,0 +1,74 @@
+/* Osmocom implementation of pseudo-random bit sequence generation */
+/* (C) 2017 by Harald Welte <laforge@gnumonks.org> */
+
+#include <stdint.h>
+#include <string.h>
+#include <osmocom/core/bits.h>
+#include <osmocom/core/prbs.h>
+
+/*! \brief PRBS-7 according ITU-T O.150 */
+const struct osmo_prbs osmo_prbs7 = {
+ /* x^7 + x^6 + 1 */
+ .name = "PRBS-7",
+ .len = 7,
+ .coeff = (1<<6) | (1<<5),
+};
+
+/*! \brief PRBS-9 according ITU-T O.150 */
+const struct osmo_prbs osmo_prbs9 = {
+ /* x^9 + x^5 + 1 */
+ .name = "PRBS-9",
+ .len = 9,
+ .coeff = (1<<8) | (1<<4),
+};
+
+/*! \brief PRBS-11 according ITU-T O.150 */
+const struct osmo_prbs osmo_prbs11 = {
+ /* x^11 + x^9 + 1 */
+ .name = "PRBS-11",
+ .len = 11,
+ .coeff = (1<<10) | (1<<8),
+};
+
+/*! \brief PRBS-15 according ITU-T O.150 */
+const struct osmo_prbs osmo_prbs15 = {
+ /* x^15 + x^14+ 1 */
+ .name = "PRBS-15",
+ .len = 15,
+ .coeff = (1<<14) | (1<<13),
+};
+
+/*! \brief Initialize the given caller-allocated PRBS state */
+void osmo_prbs_state_init(struct osmo_prbs_state *st, const struct osmo_prbs *prbs)
+{
+ memset(st, 0, sizeof(*st));
+ st->prbs = prbs;
+ st->state = 1;
+}
+
+static void osmo_prbs_process_bit(struct osmo_prbs_state *state, ubit_t bit)
+{
+ state->state >>= 1;
+ if (bit)
+ state->state ^= state->prbs->coeff;
+}
+
+/*! \brief Get the next bit out of given PRBS instance */
+ubit_t osmo_prbs_get_ubit(struct osmo_prbs_state *state)
+{
+ ubit_t result = state->state & 0x1;
+ osmo_prbs_process_bit(state, result);
+
+ return result;
+}
+
+/*! \brief Fill buffer of unpacked bits with next bits out of given PRBS instance */
+int osmo_prbs_get_ubits(ubit_t *out, unsigned int out_len, struct osmo_prbs_state *state)
+{
+ unsigned int i;
+
+ for (i = 0; i < out_len; i++)
+ out[i] = osmo_prbs_get_ubit(state);
+
+ return i;
+}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 158c37ed..37378fbc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,7 @@ check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_test \
write_queue/wqueue_test socket/socket_test \
coding/coding_test conv/conv_gsm0503_test \
abis/abis_test endian/endian_test sercomm/sercomm_test \
- stats/stats_test
+ stats/stats_test prbs/prbs_test
if ENABLE_MSGFILE
check_PROGRAMS += msgfile/msgfile_test
@@ -183,6 +183,9 @@ endian_endian_test_LDADD = $(top_builddir)/src/libosmocore.la
sercomm_sercomm_test_SOURCES = sercomm/sercomm_test.c
sercomm_sercomm_test_LDADD = $(top_builddir)/src/libosmocore.la
+prbs_prbs_test_SOURCES = prbs/prbs_test.c
+prbs_prbs_test_LDADD = $(top_builddir)/src/libosmocore.la
+
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
:;{ \
@@ -226,7 +229,7 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \
osmo-auc-gen/osmo-auc-gen_test.ok \
osmo-auc-gen/osmo-auc-gen_test.err \
conv/conv_gsm0503_test.ok endian/endian_test.ok \
- sercomm/sercomm_test.ok
+ sercomm/sercomm_test.ok prbs/prbs_test.ok
DISTCLEANFILES = atconfig atlocal conv/gsm0503_test_vectors.c
BUILT_SOURCES = conv/gsm0503_test_vectors.c
diff --git a/tests/prbs/prbs_test.c b/tests/prbs/prbs_test.c
new file mode 100644
index 00000000..f478635b
--- /dev/null
+++ b/tests/prbs/prbs_test.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <osmocom/core/prbs.h>
+
+static void dump_bits(const ubit_t *bits, unsigned int num_bits)
+{
+ unsigned int i;
+
+ for (i = 0; i < num_bits; i++) {
+ if (bits[i])
+ fputc('1', stdout);
+ else
+ fputc('0', stdout);
+ }
+ fputc('\n',stdout);
+}
+
+static void test_prbs(const struct osmo_prbs *prbs)
+{
+ struct osmo_prbs_state st;
+ unsigned int i;
+
+ printf("Testing PRBS sequence generation '%s'\n", prbs->name);
+ osmo_prbs_state_init(&st, prbs);
+
+ /* 2 lines */
+ for (i = 0; i < 2; i++) {
+ unsigned int seq_len = (1 << prbs->len)-1;
+ ubit_t bits[seq_len];
+ memset(bits, 0, sizeof(bits));
+ osmo_prbs_get_ubits(bits, sizeof(bits), &st);
+ dump_bits(bits, sizeof(bits));
+ }
+
+ printf("\n");
+}
+
+int main(int argc, char **argv)
+{
+ test_prbs(&osmo_prbs7);
+ test_prbs(&osmo_prbs9);
+ test_prbs(&osmo_prbs11);
+ test_prbs(&osmo_prbs15);
+
+ exit(0);
+}
diff --git a/tests/prbs/prbs_test.ok b/tests/prbs/prbs_test.ok
new file mode 100644
index 00000000..e0c587c4
--- /dev/null
+++ b/tests/prbs/prbs_test.ok
@@ -0,0 +1,16 @@
+Testing PRBS sequence generation 'PRBS-7'
+1000001100001010001111001000101100111010100111110100001110001001001101101011011110110001101001011101110011001010101111111000000
+1000001100001010001111001000101100111010100111110100001110001001001101101011011110110001101001011101110011001010101111111000000
+
+Testing PRBS sequence generation 'PRBS-9'
+1000010001100001001110010101011000011011110100110111001000101000010101101001111110110010010010110111111001001101010011001100000001100011001010001101001011111110100010110001110101100101100111100011111011101000001101011011011101100000101101011111010101010000001010010101111001011101110000001110011101001001111010111010100010010000110011100001011110110110011010000111011110000111111111000001111011111000101110011001000001001010011101101000111100111110011011000101010010001110001101101010111000100110001000100000000
+1000010001100001001110010101011000011011110100110111001000101000010101101001111110110010010010110111111001001101010011001100000001100011001010001101001011111110100010110001110101100101100111100011111011101000001101011011011101100000101101011111010101010000001010010101111001011101110000001110011101001001111010111010100010010000110011100001011110110110011010000111011110000111111111000001111011111000101110011001000001001010011101101000111100111110011011000101010010001110001101101010111000100110001000100000000
+
+Testing PRBS sequence generation 'PRBS-11'
+1000000001010000001000100001010101001000000011010000011100100011011101011101010001010000101000100100010101101010000110000100111100101110011100101111011100100101011101100001010111001000010111010010010100110110001111011101100101010111100000010011000010111110010010001110110101101011000110001110111101101010010110000110011100111111011110000101001100100011111101011000010001110010101101110000110101100111000111110110110001011011101001101010011110000111001100110111111111010000000100100000101101000100110010101111110000100001100101001111100011100011011011011101101101010110110000011011100011101011011010001101100101110111100101010011100000111011000110101110111000101010110100000011001000011111010011000100111110101110001000101101010100110000001111100001100011001111011111100101000011100010011011010111101100010010111010110010100011110001011001101001111110011100001111011001100101111111100100000011101000011010010011100110111011111010101000100000010101000010000010010100010110001010011101000111010010110100110011001111111111100000000011000000011110000011001100011111111011000000101110000100101100101100111100111110011110001111001101100111110111110001010001101000101110010100101110001100101101111100110100011111001011000111001110110111101011010010001100110101111111000100000110101000111000010110110010011011110111101001010010011000110111110111010001010100101000001100010001111010101100100000111101000110010010111110110010001011110101001001000011011010011101100111010111110100010001001010101011000000001110000001101100001110111001101010111110000010001100010101111010000100100100101101101100110110111111011010000101100100100111101101110010110101110011000101111110100100001001101001011110011001001111111011100000101011000100001110101001101000011110010011001110111111101010000010000100010100101010001100000101111000100100110101101111000110100110111001111010111100100010011101010111010000010100100010001101010101110000000101100000100111000101110110100101011001100001111111001100000111111000110000110111100111010011110100111001001110111011101010101010000000000
+1000000001010000001000100001010101001000000011010000011100100011011101011101010001010000101000100100010101101010000110000100111100101110011100101111011100100101011101100001010111001000010111010010010100110110001111011101100101010111100000010011000010111110010010001110110101101011000110001110111101101010010110000110011100111111011110000101001100100011111101011000010001110010101101110000110101100111000111110110110001011011101001101010011110000111001100110111111111010000000100100000101101000100110010101111110000100001100101001111100011100011011011011101101101010110110000011011100011101011011010001101100101110111100101010011100000111011000110101110111000101010110100000011001000011111010011000100111110101110001000101101010100110000001111100001100011001111011111100101000011100010011011010111101100010010111010110010100011110001011001101001111110011100001111011001100101111111100100000011101000011010010011100110111011111010101000100000010101000010000010010100010110001010011101000111010010110100110011001111111111100000000011000000011110000011001100011111111011000000101110000100101100101100111100111110011110001111001101100111110111110001010001101000101110010100101110001100101101111100110100011111001011000111001110110111101011010010001100110101111111000100000110101000111000010110110010011011110111101001010010011000110111110111010001010100101000001100010001111010101100100000111101000110010010111110110010001011110101001001000011011010011101100111010111110100010001001010101011000000001110000001101100001110111001101010111110000010001100010101111010000100100100101101101100110110111111011010000101100100100111101101110010110101110011000101111110100100001001101001011110011001001111111011100000101011000100001110101001101000011110010011001110111111101010000010000100010100101010001100000101111000100100110101101111000110100110111001111010111100100010011101010111010000010100100010001101010101110000000101100000100111000101110110100101011001100001111111001100000111111000110000110111100111010011110100111001001110111011101010101010000000000
+
+Testing PRBS sequence generation 'PRBS-15'
+1000000000000011000000000000101000000000001111000000000010001000000000110011000000001010101000000011111111000000100000001000001100000011000010100000101000111100001111001000100010001011001100110011101010101010100111111111111101000000000000111000000000001001000000000011011000000000101101000000001110111000000010011001000000110101011000001011111101000011100000111000100100001001001101100011011010110100101101111011101110110001100110011010010101010101110111111111110011000000000010101000000000111111000000001000001000000011000011000000101000101000001111001111000010001010001000110011110011001010100010101011111100111111100000101000000100001111000001100010001000010100110011000111101010101001000111111111011001000000001101011000000010111101000000111000111000001001001001000011011011011000101101101101001110110110111010011011011001110101101101010011110110111110100011011000011100101101000100101110111001101110011001010110010101011111010111111100001111000000100010001000001100110011000010101010101000111111111111001000000000001011000000000011101000000000100111000000001101001000000010111011000000111001101000001001010111000011011111001000101100001011001110100011101010011100100111110100101101000011101110111000100110011001001101010101011010111111111101111000000000110001000000001010011000000011110101000000100011111000001100100001000010101100011000111110100101001000011101111011000100110001101001101010010111010111110111001111000011001010001000101011110011001111100010101010000100111111110001101000000010010111000000110111001000001011001011000011101011101000100111100111001101000101001010111001111011111001010001100001011110010100011100010111100100100111000101101101001001110110111011010011011001101110101101010110011110111111010100011000001111100101000010000101111000110001110001001010010010011011110110110101100011011011110100101101100011101110110100100110011011101101010101100110111111110101011000000011111101000000100000111000001100001001000010100011011000111100101101001000101110111011001110011001101010010101010111110111111111000011000000001000101000000011001111000000101010001000001111110011000010000010101000110000111111001010001000001011110011000011100010101000100100111111001101101000001010110111000011111011001000100001101011001100010111101010100111000111111101001001000000111011011000001001101101000011010110111000101111011001001110001101011010010010111101110110111000110011011001001010101101011011111110111101100000011000110100000101001011100001111011100100010001100101100110010101110101010111110011111111000010100000001000111100000011001000100000101011001100001111101010100010000111111100110001000000101010011000001111110101000010000011111000110000100001001010001100011011110010100101100010111101110100111000110011101001001010100111011011111101001101100000111010110100001001111011100011010001100100101110010101101110010111110110010111000011010111001000101111001011001110001011101010010011100111110110100101000011011101111000101100110001001110101010011010011111110101110100000011110011100000100010100100001100111101100010101000110100111111001011101000001011100111000011100101001000100101111011001101110001101010110010010111111010110111000001111011001000010001101011000110010111101001010111000111011111001001001100001011011010100011101101111100100110110000101101011010001110111101110010011000110010110101001010111011111011111001100001100001010100010100011111100111100100000101000101100001111001110100010001010011100110011110100101010100011101111111100100110000000101101010000001110111110000010011000010000110101000110001011111001010011100001011110100100011100011101100100100100110101101101101011110110110111100011011011000100101101101001101110110111010110011011001111010101101010001111110111110010000011000010110000101000111010001111001001110010001011010010110011101110111010100110011001111101010101010000111111111110001000000000010011000000000110101000000001011111000000011100001000000100100011000001101100101000010110101111000111011110001001001100010011011010100110101101111101011110110000111100011010001000100101110011001101110010101010110010111111111010111000000001111001000000010001011000000110011101000001010100111000011111101001000100000111011001100001001101010100011010111111100101111000000101110001000001110010011000010010110101000110111011111001011001100001011101010100011100111111100100101000000101101111000001110110001000010011010011000110101110101001011110011111011100010100001100100111100010101101000100111110111001101000011001010111000101011111001001111100001011010000100011101110001100100110010010101101010110111110111111011000011000001101000101000010111001111000111001010001001001011110011011011100010101101100100111110110101101000011011110111000101100011001001110100101011010011101111101110100110000110011101010001010100111110011111101000010100000111000111100001001001000100011011011001100101101101010101110110111111110011011000000010101101000000111110111000001000011001000011000101011000101001111101001111010000111010001110001001110010010011010010110110101110111011011110011001101100010101010110100111111111011101000000001100111000000010101001000000111111011000001000001101000011000010111000101000111001001111001001011010001011011101110011101100110010100110101010111101011111111000111100000001001000100000011011001100000101101010100001110111111100010011000000100110101000001101011111000010111100001000111000100011001001001100101011011010101111101101111110000110110000010001011010000110011101110001010100110010011111101010110100000111111011100001000001100100011000010101100101000111110101111001000011110001011000100010011101001100110100111010101011101001111111100111010000000101001110000001111010010000010001110110000110010011010001010110101110011111011110010100001100010111100010100111000100111101001001101000111011010111001001101111001011010110001011101111010011100110001110100101010010011101111110110100110000011011101010000101100111110001110101000010010011111000110110100001001011011100011011101100100101100110101101110101011110110011111100011010100000100101111100001101110000100010110010001100111010110010101001111010111111010001111000001110010001000010010110011000110111010101001011001111111011101010000001100111110000010101000010000111111000110001000001001010011000011011110101000101100011111001110100100001010011101100011110100110100100011101011101100100111100110101101000101011110111001111100011001010000100101011110001101111100010010110000100110111010001101011001110010111101010010111000111110111001001000011001011011000101011101101001111100110111010000101011001110001111101010010010000111110110110001000011011010011000101101110101001110110011111010011010100001110101111100010011110000100110100010001101011100110010111100101010111000101111111001001110000001011010010000011101110110000100110011010001101010101110010111111110010111000000010111001000000111001011000001001011101000011011100111000101100101001001110101111011010011110001101110100010010110011100110111010100101011001111101111101010000110000111110001010001000010011110011000110100010101001011100111111011100101000001100101111000010101110001000111110010011001000010110101011000111011111101001001100000111011010100001001101111100011010110000100101111010001101110001110010110010010010111010110110111001111011011001010001101101011110010110111100010111011000100111001101001101001010111010111011111001111001100001010001010100011110011111100100010100000101100111100001110101000100010011111001100110100001010101011100011111111100100100000000101101100000001110110100000010011011100000110101100100001011110101100011100011110100100100100011101101101100100110110110101101011011011110111101101100011000110110100101001011011101111011101100110001100110101010010101011111110111111100000011000000100000101000001100001111000010100010001000111100110011001000101010101011001111111111101010000000000111110000000001000010000000011000110000000101001010000001111011110000010001100010000110010100110001010111101010011111000111110100001001000011100011011000100100101101001101101110111010110110011001111011010101010001101111111110010110000000010111010000000111001110000001001010010000011011110110000101100011010001110100101110010011101110010110100110010111011101010111001100111111001010101000001011111111000011100000001000100100000011001101100000101010110100001111111011100010000001100100110000010101101010000111110111110001000011000010011000101000110101001111001011111010001011100001110011100100010010100101100110111101110101011000110011111101001010100000111011111100001001100000100011010100001100101111100010101110000100111110010001101000010110010111000111010111001001001111001011011010001011101101110011100110110010100101011010111101111101111000110000110001001010001010011011110011110101100010100011110100111100100011101000101100100111001110101101001010011110111011110100011001100011100101010100100101111111101101110000000110110010000001011010110000011101111010000100110001110001101010010010010111110110110111000011011011001000101101101011001110110111101010011011000111110101101001000011110111011000100011001101001100101010111010101111111001111110000001010000010000011110000110000100010001010001100110011110010101010100010111111111100111000000000101001000000001111011000000010001101000000110010111000001010111001000011111001011000100001011101001100011100111010100100101001111101101111010000110110001110001011010010010011101110110110100110011011011101010101101100111111110110101000000011011111000000101100001000001110100011000010011100101000110100101111001011101110001011100110010011100101010110100101111111011101110000001100110010000010101010110000111111111010001000000001110011000000010010101000000110111111000001011000001000011101000011000100111000101001101001001111010111011010001111001101110010001010110010110011111010111010100001111001111100010001010000100110011110001101010100010010111111100110111000000101011001000001111101011000010000111101000110001000111001010011001001011110101011011100011111101100100100000110101101100001011110110100011100011011100100100101100101101101110101110110110011110011011010100010101101111100111110110000101000011010001111000101110010001001110010110011010010111010101110111001111110011001010000010101011110000111111100010001000000100110011000001101010101000010111111111000111000000001001001000000011011011000000101101101000001110110111000010011011001000110101101011001011110111101011100011000111100100101001000101101111011001110110001101010011010010111110101110111000011110011001000100010101011001100111111101010101000000111111111000001000000001000011000000011000101000000101001111000001111010001000010001110011000110010010101001010110111111011111011000001100001101000010100010111000111100111001001000101001011011001111011101101010001100110111110010101011000010111111101000111000000111001001000001001011011000011011101101000101100110111001110101011001010011111101011110100000111100011100001000100100100011001101101100101010110110101111111011011110000001101100010000010110100110000111011101010001001100111110011010101000010101111111000111110000001001000010000011011000110000101101001010001110111011110010011001100010110101010100111011111111101001100000000111010100000001001111100000011010000100000101110001100001110010010100010010110111100110111011000101011001101001111101010111010000111111001110001000001010010011000011110110101000100011011111001100101100001010101110100011111110011100100000010100101100000111101110100001000110011100011001010100100101011111101101111100000110110000100001011010001100011101110010100100110010111101101010111000110111111001001011000001011011101000011101100111000100110101001001101011111011010111100001101111000100010110001001100111010011010101001110101111111010011110000001110100010000010011100110000110100101010001011101111110011100110000010100101010000111101111110001000110000010011001010000110101011110001011111100010011100000100110100100001101011101100010111100110100111000101011101001001111100111011010000101001101110001111010110010010001111010110110010001111011010110010001101111010110010110001111010111010010001111001110110010001010011010110011110101111010100011110001111100100010010000101100110110001110101011010010011111101110110100000110011011100001010101100100011111110101100100000011110101100000100011110100001100100011100010101100100100111110101101101000011110110111000100011011001001100101101011010101110111101111110011000110000010101001010000111111011110001000001100010011000010100110101000111101011111001000111100001011001000100011101011001100100111101010101101000111111110111001000000011001011000000101011101000001111100111000010000101001000110001111011001010010001101011110110010111100011010111000100101111001001101110001011010110010011101111010110100110001111011101010010001100111110110010101000011010111111000101111000001001110001000011010010011000101110110101001110011011111010010101100001110111110100010011000011100110101000100101011111001101111100001010110000100011111010001100100001110010101100010010111110100110111000011101011001000100111101011001101000111101010111001000111111001011001000001011101011000011100111101000100101000111001101111001001010110001011011111010011101100001110100110100010011101011100110100111100101011101000101111100111001110000101001010010001111011110110010001100011010110010100101111010111101110001111000110010010001001010110110011011111011010101100001101111110100010110000011100111010000100101001110001101111010010010110001110110111010010011011001110110101101010011011110111110101100011000011110100101000100011101111001100100110001010101101010011111110111110100000011000011100000101000100100001111001101100010001010110100110011111011101010100001100111111100010101000000100111111000001101000001000010111000011000111001000101001001011001111011011101010001101100111110010110101000010111011111000111001100001001001010100011011011111100101101100000101110110100001110011011100010010101100100110111110101101011000011110111101000100011000111001100101001001010101111011011111110001101100000010010110100000110111011100001011001100100011101010101100100111111110101101000000011110111000000100011001000001100101011000010101111101000111110000111001000010001001011000110011011101001010101100111011111110101001100000011111010100000100001111100001100010000100010100110001100111101010010101000111110111111001000011000001011000101000011101001111000100111010001001101001110011010111010010101111001110111110001010011000010011110101000110100011111001011100100001011100101100011100101110100100101110011101101110010100110110010111101011010111000111101111001001000110001011011001010011101101011110100110111100011101011000100100111101001101101000111010110111001001111011001011010001101011101110010111100110010111000101010111001001111111001011010000001011101110000011100110010000100101010110001101111111010010110000001110111010000010011001110000110101010010001011111110110011100000011010100100000101111101100001110000110100010010001011100110110011100101011010100101111101111101110000110000110010001010001010110011110011111010100010100001111100111100010000101000100110001111001101010010001010111110110011111000011010100001000101111100011001110000100101010010001101111110110010110000011010111010000101111001110001110001010010010010011110110110110100011011011011100101101101100101110110110101110011011011110010101101100010111110110100111000011011101001000101100111011001110101001101010011111010111110100001111000011100010001000100100110011001101101010101010110111111111111011000000000001101000000000010111000000000111001000000001001011000000011011101000000101100111000001110101001000010011111011000110100001101001011100010111011100100111001100101101001010101110111011111110011001100000010101010100000111111111100001000000000100011000000001100101000000010101111000000111110001000001000010011000011000110101000101001011111001111011100001010001100100011110010101100100010111110101100111000011110101001000100011111011001100100001101010101100010111111110100111000000011101001000000100111011000001101001101000010111010111000111001111001001001010001011011011110011101101100010100110110100111101011011101000111101100111001000110101001011001011111011101011100001100111100100010101000101100111111001110101000001010011111000011110100001000100011100011001100100100101010101101101111111110110110000000011011010000000101101110000001110110010000010011010110000110101111010001011110001110011100010010010100100110110111101101011011000110111101101001011000110111011101001011001100111011101010101001100111111111010101000000001111111000000010000001000000110000011000001010000101000011110001111000100010010001001100110110011010101011010101111111101111110000000110000010000001010000110000011110001010000100010011110001100110100010010101011100110111111100101011000000101111101000001110000111000010010001001000110110011011001011010101101011101111110111100110000011000101010000101001111110001111010000010010001110000110110010010001011010110110011101111011010100110001101111101010010110000111110111010001000011001110011000101010010101001111110111111010000011000001110000101000010010001111000110110010001001011010110011011101111010101100110001111110101010010000011111110110000100000011010001100000101110010100001110010111100010010111000100110111001001101011001011010111101011101111000111100110001001000101010011011001111110101101010000011110111110000100011000010001100101000110010101111001010111110001011111000010011100001000110100100011001011101100101011100110101111100101011110000101111100010001110000100110010010001101010110110010111111011010111000001101111001000010110001011000111010011101001001110100111011010011101001101110100111010110011101001111010100111010001111101001110010000111010010110001001110111010011010011001110101110101010011110011111110100010100000011100111100000100101000100001101111001100010110001010100111010011111101001110100000111010011100001001110100100011010011101100101110100110101110011101011110010100111100010111101000100111000111001101001001001010111011011011111001101101100001010110110100011111011011100100001101100101100010110101110100111011110011101001100010100111010100111101001111101000111010000111001001110001001011010010011011101110110101100110011011110101010101100011111111110100100000000011101100000000100110100000001101011100000010111100100000111000101100001001001110100011011010011100101101110100101110110011101110011010100110010101111101010111110000111111000010001000001000110011000011001010101000101011111111001111100000001010000100000011110001100000100010010100001100110111100010101011000100111111101001101000000111010111000001001111001000011010001011000101110011101001110010100111010010111101001110111000111010011001001001110101011011010011111101101110100000110110011100001011010100100011101111101100100110000110101101010001011110111110011100011000010100100101000111101101111001000110110001011001011010011101011101110100111100110011101000101010100111001111111101001010000000111011110000001001100010000011010100110000101111101010001110000111110010010001000010110110011000111011010101001001101111111011010110000001101111010000010110001110000111010010010001001110110110011010011011010101110101101111110011110110000010100011010000111100101110001000101110010011001110010110101010010111011111110111001100000011001010100000101011111100001111100000100010000100001100110001100010101010010100111111110111101000000011000111000000101001001000001111011011000010001101101000110010110111001010111011001011111001101011100001010111100100011111000101100100001001110101100011010011110100101110100011101110011100100110010100101101010111101110111111000110011000001001010101000011011111111000101100000001001110100000011010011100000101110100100001110011101100010010100110100110111101011101011000111100111101001000101000111011001111001001101010001011010111110011101111000010100110001000111101010011001000111110101011001000011111101011000100000111101001100001000111010100011001001111100101011010000101111101110001110000110010010010001010110110110011111011011010100001101101111100010110110000100111011010001101001101110010111010110010111001111010111001010001111001011110010001011100010110011100100111010100101101001111101110111010000110011001110001010101010010011111111110110100000000011011100000000101100100000001110101100000010011110100000110100011100001011100100100011100101101100100101110110101101110011011110110010101100011010111110100101111000011101110001000100110010011001101010110101010111111011111111000001100000001000010100000011000111100000101001000100001111011001100010001101010100110010111111101010111000000111111001000001000001011000011000011101000101000100111001111001101001010001010111011110011111001100010100001010100111100011111101000100100000111001101100001001010110100011011111011100101100001100101110100010101110011100111110010100101000010111101111000111000110001001001001010011011011011110101101101100011110110110100100011011011101100101101100110101110110101011110011011111100010101100000100111110100001101000011100010111000100100111001001101101001011010110111011101111011001100110001101010101010010111111111110111000000000011001000000000101011000000001111101000000010000111000000110001001000001010011011000011110101101000100011110111001100100011001010101100101011111110101111100000011110000100000100010001100001100110010100010101010111100111111111000101000000001001111000000011010001000000101110011000001110010101000010010111111000110111000001001011001000011011101011000101100111101001110101000111010011111001001110100001011010011100011101110100100100110011101101101010100110110111111101011011000000111101101000001000110111000011001011001000101011101011001111100111101010000101000111110001111001000010010001011000110110011101001011010100111011101111101001100110000111010101010001001111111110011010000000010101110000000111110010000001000010110000011000111010000101001001110001111011010010010001101110110110010110011011010111010101101111001111110110001010000011010011110000101110100010001110011100110010010100101010110111101111111011000110000001101001010000010111011110000111001100010001001010100110011011111101010101100000111111110100001000000011100011000000100100101000001101101111000010110110001000111011010011001001101110101011010110011111101111010100000110001111100001010010000100011110110001100100011010010101100101110111110101110011000011110010101000100010111111001100111000001010101001000011111111011000100000001101001100000010111010100000111001111100001001010000100011011110001100101100010010101110100110111110011101011000010100111101000111101000111001000111001001011001001011011101011011101100111101100110101000110101011111001011111100001011100000100011100100001100100101100010101101110100111110110011101000011010100111000101111101001001110000111011010010001001101110110011010110011010101111010101111110001111110000010010000010000110110000110001011010001010011101110011110100110010100011101010111100100111111000101101000001001110111000011010011001000101110101011001110011111101010010100000111110111100001000011000100011000101001100101001111010101111010001111110001110010000010010010110000110110111010001011011001110011101101010010100110111110111101011000011000111101000101001000111001111011001001010001101011011110010111101100010111000110100111001001011101001011011100111011101100101001100110101111010101011110001111111100010010000000100110110000001101011010000010111101110000111000110010001001001010110011011011111010101101100001111110110100010000011011100110000101100101010001110101111110010011110000010110100010000111011100110001001100101010011010101111110101111110000011110000010000100010000110001100110001010010101010011110111111110100011000000011100101000000100101111000001101110001000010110010011000111010110101001001111011111011010001100001101110010100010110010111100111010111000101001111001001111010001011010001110011101110010010100110010110111101010111011000111111001101001000001010111011000011111001101000100001010111001100011111001010100100001011111101100011100000110100100100001011101101100011100110110100100101011011101101111101100110110000110101011010001011111101110011100000110010100100001010111101100011111000110100100001001011101100011011100110100101100101011101110101111100110011110000101010100010001111111100110010000000101010110000001111111010000010000001110000110000010010001010000110110011110001011010100010011101111100110100110000101011101010001111100111110010000101000010110001111000111010010001001001110110011011010011010101101110101111110110011110000011010100010000101111100110001110000101010010010001111110110110010000011011010110000101101111010001110110001110010011010010010110101110110111011110011011001100010101101010100111110111111101000011000000111000101000001001001111000011011010001000101101110011001110110010101010011010111111110101111000000011110001000000100010011000001100110101000010101011111000111111100001001000000100011011000001100101101000010101110111000111110011001001000010101011011000111111101101001000000110111011000001011001101000011101010111000100111111001001101000001011010111000011101111001000100110001011001101010011101010111110100111111000011101000001000100111000011001101001000101010111011001111111001101010000001010111110000011111000010000100001000110001100011001010010100101011110111101111100011000110000100101001010001101111011110010110001100010111010010100111001110111101001010011000111011110101001001100011111011010100100001101111101100010110000110100111010001011101001110011100111010010100101001110111101111010011000110001110101001010010011111011110110100001100011011100010100101100100111101110101101000110011110111001010100011001011111100101011100000101111100100001110000101100010010001110100110110010011101011010110100111101111011101000110001100111001010010101001011110111111011100011000001100100101000010101101111000111110110001001000011010011011000101110101101001110011110111010010100011001110111100101010011000101111110101001110000011111010010000100001110110001100010011010010100110101110111101011110011000111100010101001000100111111011001101000001101010111000010111111001000111000001011001001000011101011011000100111101101001101000110111010111001011001111001011101010001011100111110011100101000010100101111000111101110001001000110010011011001010110101101011111011110111100001100011000100010100101001100111101111010101000110001111111001010010000001011110110000011100011010000100100101110001101101110010010110110010110111011010111011001101111001101010110001010111111010011111000001110100001000010011100011000110100100101001011101101111011100110110001100101011010010101111101110111110000110011000010001010101000110011111111001010100000001011111100000011100000100000100100001100001101100010100010110100111100111011101000101001100111001111010101001010001111111011110010000001100010110000010100111010000111101001110001000111010010011001001110110101011010011011111101110101100000110011110100001010100011100011111100100100100000101101101100001110110110100010011011011100110101101100101011110110101111100011011110000100101100010001101110100110010110011101010111010100111111001111101000001010000111000011110001001000100010011011001100110101101010101011110111111111100011000000000100101000000001101111000000010110001000000111010011000001001110101000011010011111000101110100001001110011100011010010100100101110111101101110011000110110010101001011010111111011101111000001100110001000010101010011000111111110101001000000011111011000000100001101000001100010111000010100111001000111101001011001000111011101011001001100111101011010101000111101111111001000110000001011001010000011101011110000100111100010001101000100110010111001101010111001010111111001011111000001011100001000011100100011000100101100101001101110101111010110011110001111010100010010001111100110110010000101011010110001111101111010010000110001110110001010010011010011110110101110100011011110011100101100010100101110100111101110011101000110010100111001010111101001011111000111011100001001001100100011011010101100101101111110101110110000011110011010000100010101110001100111110010010101000010110111111000111011000001001001101000011011010111000101101111001001110110001011010011010011101110101110100110011110011101010100010100111111100111101000000101000111000001111001001000010001011011000110011101101001010100110111011111101011001100000111101010100001000111111100011001000000100101011000001101111101000010110000111000111010001001001001110011011011010010101101101110111110110110011000011011010101000101101111111001110110000001010011010000011110101110000100011110010001100100010110010101100111010111110101001111000011111010001000100001110011001100010010101010100110111111111101011000000000111101000000001000111000000011001001000000101011011000001111101101000010000110111000110001011001001010011101011011110100111101100011101000110100100111001011101101001011100110111011100101011001100101111101010101110000111111110010001000000010110011000000111010101000001001111111000011010000001000101110000011001110010000101010010110001111110111010010000011001110110000101010011010001111110101110010000011110010110000100010111010001100111001110010101001010010111111011110111000001100011001000010100101011000111101111101001000110000111011001010001001101011110011010111100010101111000100111110001001101000010011010111000110101111001001011110001011011100010011101100100110100110101101011101011110111100111100011000101000100101001111001101111010001010110001110011111010010010100001110110111100010011011000100110101101001101011110111010111100011001111000100101010001001101111110011010110000010101111010000111110001110001000010010010011000110110110101001011011011111011101101100001100110110100010101011011100111111101100101000000110101111000001011110001000011100010011000100100110101001101101011111010110111100001111011000100010001101001100110010111010101010111001111111111001010000000001011110000000011100010000000100100110000001101101010000010110111110000111011000010001001101000110011010111001010101111001011111110001011100000010011100100000110100101100001011101110100011100110011100100101010100101101111111101110110000000110011010000001010101110000011111110010000100000010110001100000111010010100001001110111100011010011000100101110101001101110011111010110010100001111010111100010001111000100110010001001101010110011010111111010101111000001111110001000010000010011000110000110101001010001011111011110011100001100010100100010100111101100111101000110101000111001011111001001011100001011011100100011101100101100100110101110101101011110011110111100010100011000100111100101001101000101111010111001110001111001010010010001011110110110011100011011010100100101101111101101110110000110110011010001011010101110011101111110010100110000010111101010000111000111110001001001000010011011011000110101101101001011110110111011100011011001100100101101010101101110111111110110011000000011010101000000101111111000001110000001000010010000011000110110000101001011010001111011101110010001100110010110010101010111010111111111001111000000001010001000000011110011000000100010101000001100111111000010101000001000111111000011001000001000101011000011001111101000101010000111001111110001001010000010011011110000110101100010001011110100110011100011101010100100100111111101101101000000110110111000001011011001000011101101011000100110111101001101011000111010111101001001111000111011010001001001101110011011010110010101101111010111110110001111000011010010001000101110110011001110011010101010010101111111110111110000000011000010000000101000110000001111001010000010001011110000110011100010001010100100110011111101101010100000110111111100001011000000100011101000001100100111000010101101001000111110111011001000011001101011000101010111101001111111000111010000001001001110000011011010010000101101110110001110110011010010011010101110110101111110011011110000010101100010000111110100110001000011101010011000100111110101001101000011111010111000100001111001001100010001011010100110011101111101010100110000111111101010001000000111110011000001000010101000011000111111000101001000001001111011000011010001101000101110010111001110010111001010010111001011110111001011100011001011100100101011100101101111100101110110000101110011010001110010101110010010111110010110111000010111011001000111001101011001001010111101011011111000111101100001001000110100011011001011100101101011100101110111100101110011000101110010101001110010111111010010111000001110111001000010011001011000110101011101001011111100111011100000101001100100001111010101100010001111110100110010000011101010110000100111111010001101000001110010111000010010111001000110111001011001011001011101011101011100111100111100101000101000101111001111001110001010001010010011110011110110100010100011011100111100101100101000101110101111001110011110001010010100010011110111100110100011000101011100101001111100101111010000101110001110001110010010010010010110110110110111011011011011001101101101101010110110110111111011011011000001101101101000010110110111000111011011001001001101101011011010110111101101111011000110110001101001011010010111011101110111001100110011001010101010101011111111111111100000000000000
+100000000000001100000000000010100000000000111100000000001000100000000011001100000000101010100000001111111100000010000000100000110000001100001010000010100011110000111100100010001000101100110011001110101010101010011111111111110100000000000011100000000000100100000000001101100000000010110100000000111011100000001001100100000011010101100000101111110100001110000011100010010000100100110110001101101011010010110111101110111011000110011001101001010101010111011111111111001100000000001010100000000011111100000000100000100000001100001100000010100010100000111100111100001000101000100011001111001100101010001010101111110011111110000010100000010000111100000110001000100001010011001100011110101010100100011111111101100100000000110101100000001011110100000011100011100000100100100100001101101101100010110110110100111011011011101001101101100111010110110101001111011011111010001101100001110010110100010010111011100110111001100101011001010101111101011111110000111100000010001000100000110011001100001010101010100011111111111100100000000000101100000000001110100000000010011100000000110100100000001011101100000011100110100000100101011100001101111100100010110000101100111010001110101001110010011111010010110100001110111011100010011001100100110101010101101011111111110111100000000011000100000000101001100000001111010100000010001111100000110010000100001010110001100011111010010100100001110111101100010011000110100110101001011101011111011100111100001100101000100010101111001100111110001010101000010011111111000110100000001001011100000011011100100000101100101100001110101110100010011110011100110100010100101011100111101111100101000110000101111001010001110001011110010010011100010110110100100111011011101101001101100110111010110101011001111011111101010001100000111110010100001000010111100011000111000100101001001001101111011011010110001101101111010010110110001110111011010010011001101110110101010110011011111111010101100000001111110100000010000011100000110000100100001010001101100011110010110100100010111011101100111001100110101001010101011111011111111100001100000000100010100000001100111100000010101000100000111111001100001000001010100011000011111100101000100000101111001100001110001010100010010011111100110110100000101011011100001111101100100010000110101100110001011110101010011100011111110100100100000011101101100000100110110100001101011011100010111101100100111000110101101001001011110111011011100011001101100100101010110101101111111011110110000001100011010000010100101110000111101110010001000110010110011001010111010101011111001111111100001010000000100011110000001100100010000010101100110000111110101010001000011111110011000100000010101001100000111111010100001000001111100011000010000100101000110001101111001010010110001011110111010011100011001110100100101010011101101111110100110110000011101011010000100111101110001101000110010010111001010110111001011111011001011100001101011100100010111100101100111000101110101001001110011111011010010100001101110111100010110011000100111010101001101001111111010111010000001111001110000010001010010000110011110110001010100011010011111100101110100000101110011100001110010100100010010111101100110111000110101011001001011111101011011100000111101100100001000110101100011001011110100101011100011101111100100100110000101101101010001110110111110010011011000010110101101000111011110111001001100011001011010100101011101111101111100110000110000101010001010001111110011110010000010100010110000111100111010001000101001110011001111010010101010001110111111110010011000000010110101000000111011111000001001100001000011010100011000101111100101001110000101111010010001110001110110010010010011010110110110101111011011011110001101101100010010110110100110111011011101011001101100111101010110101000111111011111001000001100001011000010100011101000111100100111001000101101001011001110111011101010011001100111110101010101000011111111111000100000000001001100000000011010100000000101111100000001110000100000010010001100000110110010100001011010111100011101111000100100110001001101101010011010110111110101111011000011110001101000100010010111001100110111001010101011001011111111101011100000000111100100000001000101100000011001110100000101010011100001111110100100010000011101100110000100110101010001101011111110010111100000010111000100000111001001100001001011010100011011101111100101100110000101110101010001110011111110010010100000010110111100000111011000100001001101001100011010111010100101111001111101110001010000110010011110001010110100010011111011100110100001100101011100010101111100100111110000101101000010001110111000110010011001001010110101011011111011111101100001100000110100010100001011100111100011100101000100100101111001101101110001010110110010011111011010110100001101111011100010110001100100111010010101101001110111110111010011000011001110101000101010011111001111110100001010000011100011110000100100100010001101101100110010110110101010111011011111111001101100000001010110100000011111011100000100001100100001100010101100010100111110100111101000011101000111000100111001001001101001011011010111011101101111001100110110001010101011010011111111101110100000000110011100000001010100100000011111101100000100000110100001100001011100010100011100100111100100101101000101101110111001110110011001010011010101011110101111111100011110000000100100010000001101100110000010110101010000111011111110001001100000010011010100000110101111100001011110000100011100010001100100100110010101101101010111110110111111000011011000001000101101000011001110111000101010011001001111110101